Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

Refresh projects cron function is taking too long #275

Description

@samtstern

The function refreshProjectsCron takes too long to run.
The timeout is 540s and right now it's taking over 200s, which is way too long given the fan-out architecture. It should be very fast, leaving most of the work to the other functions.

Screen Shot 2021-12-15 at 11 50 43 AM

Activity

  1. drraghavendra commented on Sep 23, 2023

    @drraghavendra

    There are a few possible reasons why a refresh projects cron function might be taking too long:

    The function is simply performing a lot of work. For example, if the function is responsible for refreshing a large number of projects, or if the projects are complex, it will naturally take longer to run.
    The function is running on a resource-constrained server. If the server is not powerful enough to handle the workload, the function will take longer to run.
    The function is waiting on external resources. For example, if the function needs to access a database or API, it will have to wait for those resources to respond.
    The function is poorly written. If the function is poorly coded, it may be inefficient and take longer to run than necessary.
    To troubleshoot the issue, you can try the following:

    Check the cron logs to see how long the function is taking to run. This will give you a good idea of where the bottleneck is.
    Try running the function manually to see if it takes the same amount of time as it does in the cron job. If it doesn't, then the problem is likely related to the cron job itself.
    Check the resources available to the server that the function is running on. If the server is underpowered, you may need to upgrade it or move the function to a different server.
    If the function is waiting on external resources, try to optimize the code to reduce the amount of time it needs to wait.
    If the function is poorly written, try to refactor the code to make it more efficient.
    Here are some additional tips for optimizing your refresh projects cron function:

    Use caching to store the results of frequently accessed queries.
    Use asynchronous programming techniques to avoid blocking the main thread.
    Use a batching strategy to process multiple projects at the same time.
    Use a load balancer to distribute the workload across multiple servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions