@mcinteerj/openclaw-gmail 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/channel.ts +15 -15
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -335,31 +335,31 @@ export const gmailPlugin: ChannelPlugin<ResolvedGmailAccount> = {
|
|
|
335
335
|
|
|
336
336
|
ctx.setStatus({ accountId: ctx.accountId, running: true, connected: true });
|
|
337
337
|
|
|
338
|
-
//
|
|
339
|
-
|
|
338
|
+
// The channel manager treats startAccount's promise resolving as the channel
|
|
339
|
+
// "exiting", which triggers auto-restart. We must keep this promise pending
|
|
340
|
+
// until the channel manager signals stop via ctx.abortSignal.
|
|
341
|
+
const signal = ctx.abortSignal;
|
|
340
342
|
|
|
341
|
-
// Start the Gmail polling monitor
|
|
342
|
-
monitorGmail({
|
|
343
|
+
// Start the Gmail polling monitor (awaits until signal is aborted)
|
|
344
|
+
await monitorGmail({
|
|
343
345
|
account: ctx.account,
|
|
344
346
|
onMessage: async (msg) => {
|
|
345
347
|
await dispatchGmailMessage(ctx, msg);
|
|
346
348
|
},
|
|
347
|
-
signal
|
|
349
|
+
signal,
|
|
348
350
|
log: ctx.log,
|
|
349
351
|
setStatus: ctx.setStatus,
|
|
350
352
|
}).catch((err) => {
|
|
351
|
-
|
|
353
|
+
if (!signal.aborted) {
|
|
354
|
+
ctx.log?.error(`[gmail] Monitor error: ${String(err)}`);
|
|
355
|
+
}
|
|
352
356
|
});
|
|
353
357
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
ctx.setStatus({ accountId: ctx.accountId, running: false, connected: false });
|
|
361
|
-
},
|
|
362
|
-
};
|
|
358
|
+
// Cleanup after monitor exits
|
|
359
|
+
if (ctx.account.email) {
|
|
360
|
+
activeAccounts.delete(ctx.account.email.toLowerCase());
|
|
361
|
+
}
|
|
362
|
+
ctx.setStatus({ accountId: ctx.accountId, running: false, connected: false });
|
|
363
363
|
},
|
|
364
364
|
},
|
|
365
365
|
};
|