Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6092 from matrix-org/babolivier/background_update…
Browse files Browse the repository at this point in the history
…_deactivated_return
  • Loading branch information
anoadragon453 committed Feb 25, 2020
2 parents c36cf3c + f99a9c9 commit 1573e9a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/6092.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the logged number of updated items for the users_set_deactivated_flag background update.
2 changes: 1 addition & 1 deletion synapse/storage/background_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def _do_background_update(self, update_name, desired_duration_ms):
duration_ms = time_stop - time_start

logger.info(
"Updating %r. Updated %r items in %rms."
"Running background update %r. Processed %r items in %rms."
" (total_rate=%r/ms, current_rate=%r/ms, total_updated=%r, batch_size=%r)",
update_name,
items_updated,
Expand Down
10 changes: 5 additions & 5 deletions synapse/storage/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ def _background_update_set_deactivated_flag_txn(txn):
rows = self.cursor_to_dict(txn)

if not rows:
return True
return True, 0

rows_processed_nb = 0

Expand All @@ -903,18 +903,18 @@ def _background_update_set_deactivated_flag_txn(txn):
)

if batch_size > len(rows):
return True
return True, len(rows)
else:
return False
return False, len(rows)

end = yield self.runInteraction(
end, nb_processed = yield self.runInteraction(
"users_set_deactivated_flag", _background_update_set_deactivated_flag_txn
)

if end:
yield self._end_background_update("users_set_deactivated_flag")

return batch_size
return nb_processed

@defer.inlineCallbacks
def add_access_token_to_user(self, user_id, token, device_id, valid_until_ms):
Expand Down

0 comments on commit 1573e9a

Please sign in to comment.