Commit 9699e509 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Sync only quotas that differ

Refs #3479

Database stack limit issue was triggered by syncing quotas for
all users. It is much faster to compare quotas locally and send
for sync to quotaholder only those that differ.
parent b92b8120
......@@ -2750,9 +2750,15 @@ def sync_users(users, sync=True, retries=3, retry_wait=1.0):
astakos_initial = initial_quotas(users)
astakos_quotas = users_quotas(users, astakos_initial)
diff_quotas = {}
for holder, local in astakos_quotas.iteritems():
registered = qh_limits.get(holder, None)
if local != registered:
diff_quotas[holder] = dict(local)
if sync:
r = register_users(nonexisting)
r = send_quotas(astakos_quotas)
r = send_quotas(diff_quotas)
return (existing, nonexisting,
qh_limits, qh_counters,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment