Fix scheduling issues on Zeabur production deployment#10
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
💡 Enable Vercel Agent with $100 free credit for automated AI reviews |
Co-authored-by: agmonetti <179014840+agmonetti@users.noreply.github.com>
Co-authored-by: agmonetti <179014840+agmonetti@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix scheduling issues for bot on Zeabur
Fix scheduling issues on Zeabur production deployment
Oct 18, 2025
agmonetti
approved these changes
Oct 18, 2025
agmonetti
approved these changes
Oct 18, 2025
agmonetti
approved these changes
Oct 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When deployed on Zeabur at 18:18 (6:18 PM), the bot would execute a few times and then stop working. The bot is configured to run every 1.5 hours from 6 AM to 11 PM (Buenos Aires time), but was failing to maintain this schedule in production.
Looking at the issue data, the last update was at
2025-10-17T08:16:31even though the bot should have continued running throughout the day. The scheduling system was breaking down after just a few execution cycles.Root Cause
The sleep calculation logic used integer hour arithmetic that didn't account for minutes and seconds:
This caused time drift that accumulated over multiple cycles. For example:
(24-23)+6 = 7 hours→ sleeps until 6:30 AM ❌After multiple cycles, these small errors compounded, causing the bot to drift outside its intended 6 AM - 11 PM operating window and eventually stop executing.
Additionally, the code had a hardcoded
6instead of using the configurablehorario_analisis_inicio, and mixedtime.localtime()withtime.time()which could cause timezone issues on UTC servers like Zeabur.Solution
Replaced integer-based calculations with precise
datetimetimestamp arithmetic:Changes
datetimeobjects withtimedeltainstead of integer hours6withhorario_analisis_iniciofrom configdatetimeobjects throughout (Buenos Aires UTC-3)Testing
Comprehensive testing confirms the fix:
Expected Behavior
After deployment, the bot will:
The logs will now show precise timestamps for better monitoring:
Or when outside the window:
Fixes the scheduling issue described where the bot would stop after running a few times.
Original prompt
Fixes #8
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.