mirror of https://github.com/jumpserver/jumpserver
perf: Change secret after successful login
parent
c2b44cfd84
commit
79c2284a01
|
@ -73,9 +73,8 @@ def change_secret_accounts_to_assets_task(account_ids, params=None, snapshot=Non
|
||||||
if trigger == 'delay':
|
if trigger == 'delay':
|
||||||
for _id in manager.account_ids:
|
for _id in manager.account_ids:
|
||||||
status = manager.get_status(_id)
|
status = manager.get_status(_id)
|
||||||
ttl = manager.get_ttl(_id)
|
|
||||||
# Check if the account is in QUEUED status
|
# Check if the account is in QUEUED status
|
||||||
if status == ChangeSecretAccountStatus.QUEUED and ttl <= 15:
|
if status == ChangeSecretAccountStatus.QUEUED:
|
||||||
account_ids.append(_id)
|
account_ids.append(_id)
|
||||||
manager.set_status(_id, ChangeSecretAccountStatus.READY)
|
manager.set_status(_id, ChangeSecretAccountStatus.READY)
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class AccountSecretTaskStatus:
|
||||||
prefix='queue:change_secret:',
|
prefix='queue:change_secret:',
|
||||||
debounce_key='debounce:change_secret:task',
|
debounce_key='debounce:change_secret:task',
|
||||||
debounce_timeout=10,
|
debounce_timeout=10,
|
||||||
queue_status_timeout=35,
|
queue_status_timeout=60,
|
||||||
default_timeout=3600,
|
default_timeout=3600,
|
||||||
delayed_task_countdown=20,
|
delayed_task_countdown=20,
|
||||||
):
|
):
|
||||||
|
@ -114,7 +114,7 @@ class AccountSecretTaskStatus:
|
||||||
data.update(metadata)
|
data.update(metadata)
|
||||||
|
|
||||||
if use_add:
|
if use_add:
|
||||||
return cache.set(key, data, timeout or self.queue_status_timeout)
|
return cache.add(key, data, timeout or self.queue_status_timeout)
|
||||||
|
|
||||||
cache.set(key, data, timeout or self.default_timeout)
|
cache.set(key, data, timeout or self.default_timeout)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue