summary refs log tree commit diff
path: root/synapse/storage/background_updates.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-10-19 18:25:03 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2020-10-19 18:25:03 +0100
commit8766a077d1cd7aa38dfc4633c9da7da9a6290108 (patch)
tree15377681cfa1fd7833059a279f5436f8659589bb /synapse/storage/background_updates.py
parentMerge commit 'bfd79c298' into anoa/dinsic_release_1_21_x (diff)
parentAdd type hints to synapse.handlers.room (#8090) (diff)
downloadsynapse-8766a077d1cd7aa38dfc4633c9da7da9a6290108.tar.xz
Merge commit 'dc22090a6' into anoa/dinsic_release_1_21_x
* commit 'dc22090a6':
  Add type hints to synapse.handlers.room (#8090)
  Remove some unused database functions. (#8085)
  Convert misc database code to async (#8087)
  Remove a space at the start of a changelog entry.
Diffstat (limited to 'synapse/storage/background_updates.py')
-rw-r--r--synapse/storage/background_updates.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/synapse/storage/background_updates.py b/synapse/storage/background_updates.py

index f43463df53..90a1f9e8b1 100644 --- a/synapse/storage/background_updates.py +++ b/synapse/storage/background_updates.py
@@ -18,8 +18,6 @@ from typing import Optional from canonicaljson import json -from twisted.internet import defer - from synapse.metrics.background_process_metrics import run_as_background_process from . import engines @@ -308,9 +306,8 @@ class BackgroundUpdater(object): update_name (str): Name of update """ - @defer.inlineCallbacks - def noop_update(progress, batch_size): - yield self._end_background_update(update_name) + async def noop_update(progress, batch_size): + await self._end_background_update(update_name) return 1 self.register_background_update_handler(update_name, noop_update) @@ -409,12 +406,11 @@ class BackgroundUpdater(object): else: runner = create_index_sqlite - @defer.inlineCallbacks - def updater(progress, batch_size): + async def updater(progress, batch_size): if runner is not None: logger.info("Adding index %s to %s", index_name, table) - yield self.db_pool.runWithConnection(runner) - yield self._end_background_update(update_name) + await self.db_pool.runWithConnection(runner) + await self._end_background_update(update_name) return 1 self.register_background_update_handler(update_name, updater)