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

Commit

Permalink
Add docstring to run callbacks function
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Jul 18, 2022
1 parent e90f402 commit b8ea213
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions synapse/storage/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,15 @@ async def runInteraction(
"""

async def _run_callbacks(callbacks: List[_CallbackListEntry]):
"""
This function takes a list of mixed sync/async callbacks and executes
the async ones first and then the sync callbacks.
We do this with the assumption that async functions call out to external
systems (e.g. to invalidate a cache) and the sync functions make these
changes on any local in-memory caches/similar, and thus must be second.
"""

sync_callbacks: List[_CallbackListEntry] = []

for cb, args, kwargs in callbacks:
Expand Down

0 comments on commit b8ea213

Please sign in to comment.