Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloudtasker::Cron::Schedule crash application load when schedule tasks due date is 720 hours in the future #45

Open
wagnerpereira opened this issue Oct 1, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@wagnerpereira
Copy link

wagnerpereira commented Oct 1, 2021

We need that cloudtasker don't brake in this casa.

CloudTasker::Cron load breaking application starts when worker tasks ETA is more then 720h in the future.

2021-10-01T15:26:04.698271Z/usr/local/bundle/gems/google-gax-1.8.2/lib/google/gax/api_callable.rb:264:in rescue in block in create_api_call': GaxError RPC failed, caused by 3:The Task.scheduleTime, 2021-11-01T03:00:00-07:00, is too far in the future. Schedule time must be no more than 720h in the future.. debug_error_string:{"created":"@1633101964.695316382","description":"Error received from peer ipv4:142.250.148.95:443","file":"src/core/lib/surface/call.cc","file_line":1069,"grpc_message":"The Task.scheduleTime, 2021-11-01T03:00:00-07:00, is too far in the future. Schedule time must be no more than 720h in the future.","grpc_status":3} (Google::Gax::InvalidArgumentError)
`
Screen Shot 2021-10-01 at 12 44 22

@wagnerpereira wagnerpereira changed the title Cloudtasker::Cron::Schedule crash application load when schedule tasks ETA is 720h in the future Cloudtasker::Cron::Schedule crash application load when schedule tasks due date is 720 hours in the future Oct 1, 2021
@alachaum
Copy link
Member

alachaum commented Oct 4, 2021

@wagnerpereira Thanks for raising this issue. GCP Cloud Tasks does not allow tasks to be scheduled more than 30 days in the future unfortunately. This limits Cron schedules to cron tasks every 30 days at most...

I believe the best approach here would be to propose another Cloudtasker cron extension leveraging GCP Cloud Scheduler (on top of the native Cloud Tasks implementation). See #20

In the meantime you can work around this limitation by configuring your job to run every day then add the following logic inside your job:

class MyMonthlyWorker
  include Cloudtasker::Worker

  def perform(*args)
    # Abort unless we're the first of the month
    return unless Time.current.day == 1

    # ... job logic
  end
end

It's not pretty but it's the best I can propose just now. I'll check if I can implement a workaround on the current task-based implementation. If I can't come up with something then I will prioritize the implementation of scheduler-based cron jobs as this issue is clearly a major one.

I have added a limitations section in the cron documentation to reflect that issue.

@alachaum alachaum added the bug Something isn't working label Oct 4, 2021
@wagnerpereira
Copy link
Author

Thanks @alachaum , it was exactly what we did to bypass until we find an elegant way to solve this google tasks limitation using cloud scheduler.

I would offer help to update the documentation but I saw you already did. Thanks again.

🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants