Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sync.Map for watching queries #171

Merged
merged 1 commit into from
Jul 20, 2024
Merged

Use sync.Map for watching queries #171

merged 1 commit into from
Jul 20, 2024

Conversation

JyotinderSingh
Copy link
Collaborator

@JyotinderSingh JyotinderSingh commented Jul 20, 2024

Refactor WatchList implementation using sync.Map for thread safety and performance improvements since we will read from this map more than we write to it (a client will likely subscribe to some queries once and then listen on them indefinitely)

  • Replaced WatchList and WatchListMutex with sync.Map for concurrent access.
  • Added AddWatcher and RemoveWatcher functions to manage watchers.
  • Updated evalQWATCH to use the new AddWatcher function.
  • Modified WatchKeys to utilize sync.Map methods for iterating and managing clients.
  • Simplified regex matching and client notification logic within WatchKeys.

@JyotinderSingh JyotinderSingh merged commit f2c4b6a into master Jul 20, 2024
2 checks passed
@JyotinderSingh JyotinderSingh deleted the qwatch branch July 20, 2024 14:19
Dev79844 pushed a commit to Dev79844/dice that referenced this pull request Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant