mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-29 13:22:47 -08:00
fix: avoid duplicate stops
This commit is contained in:
1 parent
d74883b7f7
commit
fdd427957b
1 file changed
+15
-3
@@ -100,8 +100,13 @@ const startBackgroundClient = async (session: Session): Promise<MatrixClient> =>
|
||||
timelineLimit: 1,
|
||||
};
|
||||
|
||||
await startClient(mx, startOpts);
|
||||
return mx;
|
||||
try {
|
||||
await startClient(mx, startOpts);
|
||||
return mx;
|
||||
} catch (error) {
|
||||
stopClient(mx);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -302,7 +307,8 @@ export function BackgroundNotifications() {
|
||||
|
||||
await waitForSync(mx);
|
||||
|
||||
if (disposed || current.get(session.userId) !== mx) {
|
||||
if (disposed) return;
|
||||
if (current.get(session.userId) !== mx) {
|
||||
stopClient(mx);
|
||||
return;
|
||||
}
|
||||
@@ -330,6 +336,12 @@ export function BackgroundNotifications() {
|
||||
});
|
||||
}
|
||||
|
||||
if (disposed) return;
|
||||
if (current.get(session.userId) !== mx) {
|
||||
stopClient(mx);
|
||||
return;
|
||||
}
|
||||
|
||||
const pushProcessor = mx.pushProcessor;
|
||||
|
||||
const handleAccountData = (event: MatrixEvent) => {
|
||||
|
||||
Reference in new issue
Block a user