fix(watcher): force IPv4 for PM2 and widen process-messages defaults

Avoid Gmail hang on rpi4 broken IPv6 Happy Eyeballs, and default backfill to 30d inbox / max 500.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-13 23:12:37 +07:00
co-authored by Cursor
parent 46a2e2a7b0
commit 334d688b50
3 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ Gmail Date on a forward is “today”; `trx_date` still comes from the receipt
npm run list-messages -- npm run list-messages --
npm run list-messages -- --query 'newer_than:14d has:attachment filename:eml' --max 100 npm run list-messages -- --query 'newer_than:14d has:attachment filename:eml' --max 100
# Dry-run recent Livin/Grab subjects (default query: newer_than:7d) # Dry-run last 30 days of inbox (default query: in:inbox newer_than:30d)
npm run process-messages -- --dry-run npm run process-messages -- --dry-run
# Process a wrapper mail that has .eml attachments # Process a wrapper mail that has .eml attachments
+3
View File
@@ -22,6 +22,9 @@ module.exports = {
env: { env: {
NODE_ENV: "production", NODE_ENV: "production",
WATCHER_PORT: "8083", WATCHER_PORT: "8083",
// Pi has broken global IPv6 (SYN-SENT via link-local); Happy Eyeballs hangs Gmail calls.
NODE_OPTIONS:
"--dns-result-order=ipv4first --no-network-family-autoselection",
}, },
}, },
], ],
+4 -5
View File
@@ -14,10 +14,10 @@
* npm run process-messages -w watcher -- --dry-run --max 20 * npm run process-messages -w watcher -- --dry-run --max 20
* *
* Options: * Options:
* --query <q> Gmail search (default targets Livin/Grab subjects, newer_than:7d) * --query <q> Gmail search (default: in:inbox newer_than:30d)
* --ids <a,b> Explicit message IDs (skips list search) * --ids <a,b> Explicit message IDs (skips list search)
* --user <email> Mailbox to use (default: first user with tokens) * --user <email> Mailbox to use (default: first user with tokens)
* --max <n> Max messages to process (default 50) * --max <n> Max messages to process (default 500)
* --dry-run Parse and log only; do not write PocketBase * --dry-run Parse and log only; do not write PocketBase
*/ */
@@ -36,15 +36,14 @@ import { runPipeline } from "../src/pipeline.js";
import { processFetchedMessage } from "../src/process-fetched.js"; import { processFetchedMessage } from "../src/process-fetched.js";
import { pocketbaseConfigured } from "../src/pocketbase/client.js"; import { pocketbaseConfigured } from "../src/pocketbase/client.js";
const DEFAULT_QUERY = const DEFAULT_QUERY = "in:inbox newer_than:30d";
'newer_than:7d (subject:"Pembayaran Berhasil!" OR subject:"Your Grab E-Receipt" OR subject:"Pemindahan Dana Sesama Rekening BRI")';
function parseArgs(argv) { function parseArgs(argv) {
const out = { const out = {
query: null, query: null,
ids: [], ids: [],
user: null, user: null,
max: 50, max: 500,
dryRun: false, dryRun: false,
help: false, help: false,
}; };