from threading import * from time import * from grass import config from grass.logic import jwt_enabled_services class refreshCache(Thread): def run(self): jwtInstance = jwt_enabled_services.jwtEnabledServices.getInstance() isThread = True while True: sleep(int(config.JWT_REFRESH_INTERVAL)) # Delete jwt_enabled_services list from the cache if exits. jwtInstance.deleteCache(config.JWT_SECRET_NAME) jwtInstance.cacheJwtEnabledServices(isThread) data = jwtInstance.getCache(config.JWT_SECRET_NAME) log = jwtInstance.logger() log.info( f'JwtEnabledServices: ' f'Refresh cache after every ' f'{config.JWT_REFRESH_INTERVAL} ' f'hours of interval ' f'Data {data}' )