Skip to content

Integrate Time API for Accurate Cron Job Scheduling #508

@tholulomo

Description

@tholulomo

Description:
We are experiencing server crashes during the day, which is suspected to be caused by our nightly cron job running at the wrong time. To address this, we need to integrate an API that provides the current time in the US/Eastern time zone at server start. This will allow us to calculate the time remaining until midnight and schedule the cron job accordingly. This implementation will help ensure the cron job runs at the intended time, potentially resolving the server crash issue.

Tasks:

  1. Access the Swagger Documentation for Timeapi.io
  2. API Integration:
    • Implement code to call the API at server start to fetch the current time in the US/Eastern time zone.
    • Calculate the time remaining until midnight based on the API response.
  3. Schedule Cron Job:
    • Schedule the cron job to trigger once the calculated time until midnight is reached.
  4. Enhanced Logging:
    • Improve the logging mechanism to capture more detailed information about the server's state during crashes, including memory usage and CPU load.
  5. A/B Testing:
    • Conduct an A/B test comparing the current scheduling method with the API-based scheduling to evaluate effectiveness and cost-efficiency.
  6. Review Results:
    • Analyze the results from the A/B test to determine if the API integration resolves the issue.

Acceptance Criteria:

  • The Swagger documentation is access.
  • The server calls the API at start-up and correctly fetches the current time in the US/Eastern time zone.
  • The time remaining until midnight is accurately calculated.
  • The cron job is scheduled to run at the calculated time.
  • Logs provide detailed information on server performance and state during crashes.
  • A/B testing is completed, and results are reviewed to confirm the effectiveness of the solution.

Priority: High

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions