Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
continue
record_id, record_table = match.groups()
local_version = self.client._store.get_current_version(
record_table, record_id
)
if event["value"] > local_version:
logger.debug(
"Record {}/{} has changed; refreshing to update from version {} to version {}".format(
record_table, record_id, local_version, event["value"]
)
)
records_to_refresh[record_table].append(record_id)
else:
logger.debug(
"Record {}/{} already at version {}, not trying to update to version {}".format(
record_table, record_id, local_version, event["value"]
)
)
if key.startswith("collection/"):
match = re.match("collection/(.+)", key)
if not match:
continue
collection_id = match.groups()[0]
self.client.refresh_collection_rows(collection_id)
row_ids = self.client._store.get_collection_rows(collection_id)
def initialize(self):
logger.debug("Initializing new monitoring session.")
response = self.client.session.get(
"{}?sessionId={}&EIO=3&transport=polling".format(
self.root_url, self.session_id
)
)
self.sid = self._decode_numbered_json_thing(response.content)[0]["sid"]
logger.debug("New monitoring session ID is: {}".format(self.sid))
# resubscribe to any existing subscriptions if we're reconnecting
old_subscriptions, self._subscriptions = self._subscriptions, set()
self.subscribe(old_subscriptions)
def initialize(self):
logger.debug("Initializing new monitoring session.")
response = self.client.session.get(
"{}?sessionId={}&EIO=3&transport=polling".format(
self.root_url, self.session_id
)
)
self.sid = self._decode_numbered_json_thing(response.content)[0]["sid"]
logger.debug("New monitoring session ID is: {}".format(self.sid))
# resubscribe to any existing subscriptions if we're reconnecting
old_subscriptions, self._subscriptions = self._subscriptions, set()
self.subscribe(old_subscriptions)
def _decode_numbered_json_thing(self, thing):
thing = thing.decode().strip()
for ping in re.findall('\d+:\d+"primus::ping::\d+"', thing):
logger.debug("Received ping: {}".format(ping))
self.post_data(ping.replace("::ping::", "::pong::"))
results = []
for blob in re.findall("\d+:\d+(\{.*?\})(?=\d|$)", thing):
results.append(json.loads(blob))
if thing and not results and "::ping::" not in thing:
logger.debug("Could not parse monitoring response: {}".format(thing))
return results