Skip to content

Commit

Permalink
fix subscription for multiple clients (#112)
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Ding <[email protected]>
  • Loading branch information
jzding authored Dec 18, 2024
1 parent f42b3f2 commit 225a3d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
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

0 comments on commit 225a3d2

Please sign in to comment.