diff --git a/changelog.d/7981.misc b/changelog.d/7981.misc new file mode 100644 index 000000000000..dfe4c03171d6 --- /dev/null +++ b/changelog.d/7981.misc @@ -0,0 +1 @@ +Convert various parts of the codebase to async/await. diff --git a/synapse/push/httppusher.py b/synapse/push/httppusher.py index 4c469efb20e2..a5b64292a4ca 100644 --- a/synapse/push/httppusher.py +++ b/synapse/push/httppusher.py @@ -13,6 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import inspect import logging from prometheus_client import Counter @@ -296,7 +297,11 @@ async def _process_one(self, push_action): ) else: logger.info("Pushkey %s was rejected: removing", pk) - await self.hs.remove_pusher(self.app_id, pk, self.user_id) + # remove_pusher might return an awaitable (for the main + # process) or None (for a worker process). + result = self.hs.remove_pusher(self.app_id, pk, self.user_id) + if inspect.isawaitable(result): + await result return True async def _build_notification_dict(self, event, tweaks, badge):