increase polling time for trigger bc 5 seconds or less still get charged lol

This commit is contained in:
dal 2025-07-18 16:12:03 -06:00
parent 97a8bb4c56
commit f9786c75c8
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
1 changed files with 7 additions and 2 deletions

View File

@ -380,11 +380,16 @@ export const slackAgentTask: ReturnType<
let isComplete = false;
let analystResult: { ok: boolean; output?: unknown; error?: unknown } | null = null;
const maxPollingTime = 30 * 60 * 1000; // 30 minutes
const pollingInterval = 5000; // 5 seconds
const initialPollingInterval = 20000; // 20 seconds for first wait
const subsequentPollingInterval = 10000; // 10 seconds for subsequent waits
const startTime = Date.now();
let isFirstPoll = true;
while (!isComplete && Date.now() - startTime < maxPollingTime) {
await wait.for({ seconds: pollingInterval / 1000 });
// Wait with different intervals: 20s for first poll, 10s for subsequent polls
const currentInterval = isFirstPoll ? initialPollingInterval : subsequentPollingInterval;
await wait.for({ seconds: currentInterval / 1000 });
isFirstPoll = false;
try {
const run = await runs.retrieve(analystHandle.id);