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

Fix the return value in the users_set_deactivated_flag background job #6092

Merged
merged 5 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -844,7 +844,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 @@ -860,18 +860,18 @@ def _background_update_set_deactivated_flag_txn(txn):
)
babolivier marked this conversation as resolved.
Show resolved Hide resolved

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