Ensure the appservice bot user is registered

Synapse does it automatically, but Conduit requires this HTTP call.
This commit is contained in:
Cadence Ember 2023-10-16 16:47:42 +13:00
parent a542bbdca7
commit 762e48230c
2 changed files with 13 additions and 6 deletions

View file

@ -36,7 +36,7 @@ async function createSim(user) {
await api.register(localpart)
} catch (e) {
// If user creation fails, manually undo the database change. Still isn't perfect, but should help.
// (A transaction would be preferable, but I don't think it's safe to leave transaction open across event loop ticks.)
// (I would prefer a transaction, but it's not safe to leave transactions open across event loop ticks.)
db.prepare("DELETE FROM sim WHERE user_id = ?").run(user.id)
throw e
}