Skip to content

Commit 515339b

Browse files
committed
Update gm_api.ts
1 parent 89cb1f7 commit 515339b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/app/service/content/gm_api/gm_api.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,11 @@ export default class GMApi extends GM_Base {
14091409
error = null; // GC
14101410
};
14111411
const onStart = async (con: MessageConnect) => {
1412-
if (killConn === null || done) return;
1412+
if (killConn === null || done) {
1413+
// already resolved
1414+
con.disconnect();
1415+
return;
1416+
}
14131417
try {
14141418
result = await cb();
14151419
} catch (e) {
@@ -1424,7 +1428,7 @@ export default class GMApi extends GM_Base {
14241428
onDisconnected(); // in case .disconnect() not working
14251429
};
14261430
this.connect("runExclusive", [key]).then((con) => {
1427-
if (killConn === null) {
1431+
if (killConn === null || done) {
14281432
// already resolved
14291433
con.disconnect();
14301434
return;

0 commit comments

Comments
 (0)