-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
appservice: reset recoverer backoff on login
- Loading branch information
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,3 +78,7 @@ book/ | |
|
||
# Don't include users' poetry configs | ||
/poetry.toml | ||
|
||
data/ | ||
registration.yaml | ||
registration.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
synapse/module_api/callbacks/appservice_login_callbacks.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from typing import TYPE_CHECKING, Union | ||
|
||
|
||
if TYPE_CHECKING: | ||
from synapse.server import HomeServer | ||
from synapse.appservice import ApplicationService | ||
|
||
class AppserviceLoginModuleApiCallbacks: | ||
def __init__(self, hs: "HomeServer") -> None: | ||
self.scheduler = hs.get_application_service_scheduler() | ||
|
||
async def reset_recoverer_backoff(self, appservice: "ApplicationService"): | ||
print(appservice, "resetting backoff, retrying transactions immediately") | ||
|
||
appservice_id = appservice.id | ||
|
||
if appservice_id not in self.scheduler.txn_ctrl.recoverers: | ||
print(appservice, "no recoverer found to reset") | ||
return | ||
|
||
self.scheduler.txn_ctrl.recoverers[appservice_id].reset() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters