Skip to content

Commit 0a5bf27

Browse files
authored
Merge pull request #29 from marinso/fix_lists
Fix lists
2 parents 2b4e157 + 71a0910 commit 0a5bf27

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: lib/deepstream/list.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module Deepstream
55
class List < Record
66
LIST_CALLBACKS = %i{added removed}
77

8+
attr_reader :version
9+
810
def initialize(*args)
911
super
1012
@data = []
@@ -15,7 +17,7 @@ def add(record_name)
1517
unless @data.include?(record_name)
1618
@data << record_name
1719
set
18-
notify_listeners(:removed, record_name)
20+
notify_listeners(:added, record_name)
1921
end
2022
rescue => e
2123
@client.on_exception(e)
@@ -98,4 +100,4 @@ def notify_listeners(cb_name, uid)
98100
end
99101
end
100102
end
101-
end
103+
end

Diff for: lib/deepstream/record_handler.rb

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def get(name, list: nil)
3232
if list
3333
name.prepend("#{list}/")
3434
@records[list] ||= List.new(@client, list)
35+
sleep 0.1 while @records[list].version.nil?
3536
@records[list].add(name)
3637
end
3738
@records[name] ||= Record.new(@client, name)

0 commit comments

Comments
 (0)