Only refresh current instance service key
This commit is contained in:
parent
a6f6a114c2
commit
489752a0b7
3 changed files with 14 additions and 19 deletions
|
@ -1,8 +1,8 @@
|
|||
import logging
|
||||
from datetime import timedelta
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from app import app
|
||||
from data.model.service_keys import refresh_automatic_service_keys
|
||||
from data.model.service_keys import set_key_expiration
|
||||
from workers.worker import Worker
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -14,13 +14,17 @@ class ServiceKeyWorker(Worker):
|
|||
app.config.get('QUAY_SERVICE_KEY_REFRESH', 60)*60)
|
||||
|
||||
def _refresh_service_keys(self):
|
||||
""" Refreshes active service keys so they don't get garbage collected. """
|
||||
"""
|
||||
Refreshes active service keys so they don't get garbage collected.
|
||||
"""
|
||||
with open("/conf/quay.kid") as f:
|
||||
kid = f.read()
|
||||
|
||||
minutes_until_expiration = app.config.get('QUAY_SERVICE_KEY_EXPIRATION', 120)
|
||||
expiration = timedelta(minutes=minutes_until_expiration)
|
||||
|
||||
logger.debug('Starting refresh of automatic service keys')
|
||||
refresh_automatic_service_keys(expiration)
|
||||
set_key_expiration(kid, datetime.now() + expiration)
|
||||
logger.debug('Finished refresh of automatic service keys')
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Reference in a new issue