Revision cdd8478b psng-pyserf.py

View differences:

psng-pyserf.py
140 140
                            if c_tag not in self.last_channels_tags_list:
141 141
                                self.update_db_from_members()
142 142
                                return 0
143

  
144
            if self.last_channels_tags_list:
145
                self.update_db_from_members()
143 146
        else:
144 147
            sys.stderr.write("Serf streamed event failed\n")
145 148
            sys.stderr.write("%s" % (resp.error,))
......
149 152
    def listen_for_member_update_events(self, ch_dbfile):
150 153
        print "Database file: %s" % (ch_dbfile,)
151 154

  
155
        members_updated = False
152 156
        while True:
153 157

  
154 158
            # Write the db file based on the current members channels tags
155
            members_updated = False
156 159
            sleep_time = 5
157 160

  
158 161
            self.client = serf.Client("%s:%d" % (self.rpc_address,
......
178 181
                self.client.stream(Type="member-update").add_callback(
179 182
                                   self.member_update_event_callback).request(
180 183
                                   timeout=120)
184
                self.client.disconnect()
185
                members_updated = False
181 186
            except serf._exceptions.ConnectionError:
182 187
                print "Client connection error (sleep %d)" % (sleep_time,)
183 188
                time.sleep(sleep_time)

Also available in: Unified diff