800k+ms wall time? 3ms CPU time

I'm constantly getting massive wall time on a scheduled task that has very short CPU time. Does anyone have some insight they can lend? (See attached pic) The only code in the script is below, and the DB size is tiny (only about 400 records) const conditions = [ ularn=1 and winner=1, // ularn=1 and winner=0, // ularn=0 and winner=1, // ularn=0 and winner=0, ]; for (const condition of conditions) { const { success } = await env.DB.prepare( DELETE FROM ${CF_COMPLETED_GAMES_TABLE} WHERE ${condition} AND gameID NOT IN ( SELECT gameID FROM ${CF_COMPLETED_GAMES_TABLE} WHERE ${condition} ORDER BY createdAt DESC LIMIT 100 ) ).run(); console.log(pruneCompletedGamesTable(): cleaned up completed games table ${condition}, success); } return true;
No description
1 Reply
Eye of Larn
Eye of LarnOP3mo ago
As an update to my previous post, I was still getting significant wall time (100k+ms) even when I commented out all of my code. So I deleted the hourly cron and just added a check to run what I needed at the 27th minute since I have a minute cron as well. Wall times dropped completely. I have no idea what's going on, but I wonder if it's because everyone runs hourly crons and they are swamping the servers.

Did you find this page helpful?