Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the bot-sdk crypto by initializing the bot-sdk earlier #512

Merged
merged 5 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@ mjolnir.egg-info/
.yarn
# Only contains possibly broken path, replaced by .yarnrc.yml in modern Yarn
.yarnrc

# VS Code workspace settings
/.vscode
8 changes: 6 additions & 2 deletions src/Draupnir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,15 @@ export class Draupnir implements Client {
if (isError(managementRoomProtectResult)) {
return managementRoomProtectResult;
}
void Task(draupnir.startupComplete());
return Ok(draupnir);
}

private async startupComplete(): Promise<void> {
/**
* Note: This is only public due to having to first start the syncloop before sending events
* when we use encryption.
* This means this is only used in the index.ts.
*/
public async startupComplete(): Promise<void> {
const statusInfo = await draupnirStatusInfo(this);
try {
await this.managementRoomOutput.logMessage(
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
} from "./DraupnirBotMode";
import { Draupnir } from "./Draupnir";
import { SafeMatrixEmitterWrapper } from "matrix-protection-suite-for-matrix-bot-sdk";
import { DefaultEventDecoder } from "matrix-protection-suite";
import { DefaultEventDecoder, Task } from "matrix-protection-suite";
import { WebAPIs } from "./webapis/WebAPIs";
import { SqliteRoomStateBackingStore } from "./backingstore/better-sqlite3/SqliteRoomStateBackingStore";

Expand Down Expand Up @@ -120,6 +120,7 @@ void (async function () {
try {
await bot.start();
await config.RUNTIME.client.start();
void Task(bot.startupComplete());
await apis.start();
healthz.isHealthy = true;
} catch (err) {
Expand Down
Loading