mirror of https://github.com/jumpserver/jumpserver
fix: redis 订阅 bug
parent
55fae1667d
commit
f994f5d776
|
@ -79,7 +79,7 @@ def subscribe_node_assets_mapping_expire(sender, **kwargs):
|
|||
Node.expire_node_all_asset_ids_mapping_from_memory(root_org_id)
|
||||
|
||||
def keep_subscribe_node_assets_relation():
|
||||
node_assets_mapping_for_memory_pub_sub.keep_handle_msg(handle_node_relation_change)
|
||||
node_assets_mapping_for_memory_pub_sub.subscribe(handle_node_relation_change)
|
||||
|
||||
t = threading.Thread(target=keep_subscribe_node_assets_relation)
|
||||
t.daemon = True
|
||||
|
|
|
@ -90,6 +90,7 @@ class RedisPubSub:
|
|||
|
||||
def subscribe(self, _next, error=None, complete=None):
|
||||
ps = self.redis.pubsub()
|
||||
ps.subscribe(self.ch)
|
||||
sub = Subscription(self.ch, ps)
|
||||
sub.keep_handle_msg(_next, error, complete)
|
||||
return sub
|
||||
|
|
|
@ -46,7 +46,7 @@ def subscribe_orgs_mapping_expire(sender, **kwargs):
|
|||
logger.debug("Start subscribe for expire orgs mapping from memory")
|
||||
|
||||
def keep_subscribe_org_mapping():
|
||||
orgs_mapping_for_memory_pub_sub.keep_handle_msg(
|
||||
orgs_mapping_for_memory_pub_sub.subscribe(
|
||||
lambda org_id: Organization.expire_orgs_mapping()
|
||||
)
|
||||
|
||||
|
|
|
@ -80,9 +80,7 @@ def subscribe_settings_change(sender, **kwargs):
|
|||
logger.debug("Start subscribe setting change")
|
||||
|
||||
def keep_subscribe_settings_change():
|
||||
setting_pub_sub.keep_handle_msg(
|
||||
lambda name: Setting.refresh_item(name)
|
||||
)
|
||||
setting_pub_sub.subscribe(lambda name: Setting.refresh_item(name))
|
||||
|
||||
t = threading.Thread(target=keep_subscribe_settings_change)
|
||||
t.daemon = True
|
||||
|
|
Loading…
Reference in New Issue