reduced redis access count
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2021-12-11 00:08:17 +01:00
parent f6d36a9f87
commit ba8718054b

View File

@ -66,12 +66,13 @@ class AssignmentView(FlaskView):
if default_target: if default_target:
target_site = default_target target_site = default_target
redis_client.set(schedule_store_key, default_target) redis_client.set(schedule_store_key, default_target, ex=current_app.config['DEVICE_TIMEOUT'])
# Update (or set) TTL else:
redis_client.expire( # Just Update TTL
schedule_store_key, redis_client.expire(
current_app.config['DEVICE_TIMEOUT'] schedule_store_key,
) current_app.config['DEVICE_TIMEOUT']
)
return jsonify(self._resolve_response(target_site)) return jsonify(self._resolve_response(target_site))