perf: 优化账号任务

This commit is contained in:
ibuler
2023-02-21 13:00:04 +08:00
parent b49b7125b2
commit e67a876513
21 changed files with 147 additions and 118 deletions

View File

@@ -284,7 +284,5 @@ class Asset(NodesRelationMixin, AbsConnectivity, JMSOrgBaseModel):
('push_assetaccount', _('Can push account to asset')),
('test_account', _('Can verify account')),
('match_asset', _('Can match asset')),
('add_assettonode', _('Add asset to node')),
('move_assettonode', _('Move asset to node')),
('remove_assetfromnode', _('Remove asset from node'))
('change_assettonode', _('Can change asset nodes')),
]

View File

@@ -30,11 +30,11 @@ class Domain(JMSOrgBaseModel):
def random_gateway(self):
gateways = [gw for gw in self.active_gateways if gw.is_connective]
if not gateways:
logger.warn(f'Gateway all bad. domain={self}, gateway_num={len(gateways)}.')
gateways = self.active_gateways
if not gateways:
logger.warn(f'Not active gateway. domain={self}')
logger.warn(f'Not active gateway, domain={self}, pass')
return None
return random.choice(gateways)