Skip to content

Instantly share code, notes, and snippets.

@calmh
Created June 22, 2016 12:32
Show Gist options
  • Save calmh/84300667910f520b1c5f4ef6098e28ef to your computer and use it in GitHub Desktop.
Save calmh/84300667910f520b1c5f4ef6098e28ef to your computer and use it in GitHub Desktop.
lib/events/events.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/events/events.go b/lib/events/events.go
index 5d44bb4..8923aef 100644
--- a/lib/events/events.go
+++ b/lib/events/events.go
@@ -255,6 +255,7 @@ func NewBufferedSubscription(s *Subscription, size int) BufferedSubscription {
}
func (s *bufferedSubscription) pollingLoop() {
+ localID := 1
for {
ev, err := s.sub.Poll(60 * time.Second)
if err == ErrTimeout {
@@ -267,6 +268,9 @@ func (s *bufferedSubscription) pollingLoop() {
panic("unexpected error: " + err.Error())
}
+ ev.ID = localID
+ localID++
+
s.mut.Lock()
s.buf[s.next] = ev
s.next = (s.next + 1) % len(s.buf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment