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

fix subscription for multiple clients #112

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@
# vendor/
cover.out
v1/subscriber/subscribers

.idea
.cache
.dccache

16 changes: 1 addition & 15 deletions v1/subscriber/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,20 +272,6 @@ func (p *API) GetSubscriberURLByResource(resource string) (urls []string) {
return urls
}

// GetClientIDByResource get subscriptionOne information
func (p *API) GetClientIDByResource(resource string) (clientIDs []uuid.UUID) {
p.SubscriberStore.RLock()
defer p.SubscriberStore.RUnlock()
for _, subs := range p.SubscriberStore.Store {
for _, sub := range subs.SubStore.Store {
if strings.Contains(sub.GetResource(), resource) {
clientIDs = append(clientIDs, subs.ClientID)
}
}
}
return clientIDs
}

// GetClientIDBySubID ...
func (p *API) GetClientIDBySubID(subID string) (clientIDs []uuid.UUID) {
p.SubscriberStore.RLock()
Expand All @@ -300,7 +286,7 @@ func (p *API) GetClientIDBySubID(subID string) (clientIDs []uuid.UUID) {
return clientIDs
}

// GetClientIDAddressByResource get subscriptionOne information
// GetClientIDAddressByResource get subscriptionOne information
func (p *API) GetClientIDAddressByResource(resource string) map[uuid.UUID]*types.URI {
clients := map[uuid.UUID]*types.URI{}
p.SubscriberStore.RLock()
Expand Down