ModuleAPI: Provide mechanism for modules to perform async initialisation (that is allowed to fail)
See original GitHub issueTo carry over what was raised here:
Currently a module is instantiated via its
__init__
method, which (as a magic method) shouldn’t really be async (as far as I know). What if we have a use-case that involves asynchronous initialisation of a module? E.g. Let’s say we need to translate some non-local room aliases into room IDs on module initialisation and want to report an error (to Synapse) if that fails.
When I say “allowed to fail” (in the title), I mean similarly to how a module’s parse_config
static method may fail in a controlled manner.
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
AngularJS : Initialize service with asynchronous data
You can, for example, use the module.constant mechanism to make data available to your app: myApp.constant('myAppConfig', data);.
Read more >Async Provider Initialization #525 - Urigo/graphql-modules
Is there a way to do initialization of providers that involves asynchronous steps? I want to do something like connect to the database...
Read more >Initialization, Finalization, and Threads — Python 3.11.1 ...
In an application embedding Python, the Py_Initialize() function must be called before using any other Python/C API functions; with the exception of a...
Read more >Async hooks | Node.js v19.3.0 Documentation
The node:async_hooks module provides an API to track asynchronous resources. It can be accessed using: import async_hooks from 'node:async_hooks'; ...
Read more >The Proper Way to Write Async Constructors in JavaScript
The Solution: Static Async Factory Functions! In the first workaround, I hinted at how the constructor may return arbitrary non-primitive ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Side thought: perhaps adding a prometheus metric that you can then alert on might give you want you want?
No worries! If it turns out there is a use case feel free to reopen 👍