I've configured and AWS EventBridge schedule that triggers a lambda target every hour.
How can I best test this trigger without having to wait until the schedule is reaching 1 hour?
Sometime things are simple....
The Lambda interface actually provides a Test function with with you can generate events:
I guess I looked in the wrong place to generate events (in the eventbridge itself).
Related
Is there a way to add a timing trigger for zapier to run a flow every X minutes ?
I was using recurrence in power automate and it was pretty easy to configure it, in zapier i find only the Schedule trigger but i can configure it only for each hour
If you can fire off a webhook using a simple script & cron job, you could have Zapier catch the hook and use that as your trigger.
I'm trying to build a serverless async polling service that triggers an async data request, waits for it to finish (by trying periodically) and then polling the response once its ready.
Ideally, I would trigger the data request with Lambda and push an event for EventBridge to later be processed by another Lambda that queries the API to see if the reseponse is ready, and if not - push a new event to EventBridge to try again later. For that to work, I need a way to make EventBridge wait before it forwards the event onwards. I'm trying to come up with a solution that doesn't require Lambda idle time.
Is there a way to make EventBridge wait on an event before it is pushed onwards? Or alternatively to setup a one-time scheduled event?
Sounds like the newly announced EventBridge scheduled events would solve your problem! You could simply schedule your event for Date.now() + x seconds or similar.
Announcement blog post: https://aws.amazon.com/blogs/compute/introducing-amazon-eventbridge-scheduler/
AWS Docs: https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html
Amazon SQS delay queues provides that functionality:
Delay queues let you postpone the delivery of new messages to a queue
for a number of seconds, for example, when your consumer application
needs additional time to process messages.
I am building a project in Jenkins and want to launch tests right after it, wait
until the tests are finished and than run another job to analyze the results. The testing system is a close system (I can't modify it) so in order to check if the tests are finish I need to query the system every X seconds. One way to so that is to create a job that will query the system but it will take a slot (I can create 1000 slots but it looks like a hack). is there another way to make the job "sleep" while it is waiting for the next X seconds so it will not take a slot while waiting for another process to finish ?
You can trigger one Jenkins job from another. No need to make jobs sleep or anything complicated like that. Look at upstream and downstream triggers using the parameterized build plugin.
https://plugins.jenkins.io/parameterized-trigger
What's the best way to send http requests to external api every n number of seconds? Where n is changing after every request.
I have inifinite loop which calculates time interval and sends http request, but I don't know what's the best way to use it in Rails app.
I though sidekiq would be perfect solution. With chained jobs, where job would send request, calculate time interval and schedule another job with set(wait: n). But it looks like Sidekiq has polling interval and set(wait: n) does not run request in exactly n seconds.
How would you do something like this?
You are totally right about Sidekiq. It will be the best solution I think. Polling interval can be configured via average_scheduled_poll_interval . Here there are documentation
Do so:
Create an async job
After the job is completed queue the same job and ask Sidekiq to wait some time. SMSDelegationJob.perform_later(wait: 10.seconds)
Don't forget to develop good logic for exception handling
Don't forget to set low polling interval
Smart root job manually or via console.
Good luck with it.
Is it n seconds between requests (i.e. from when the last one completed to when the next one starts), or should they start every n seconds, regardless of how long the last one took (or if it was successful or not)?
Answering that question should tell you whether the requests need to be made in parallel (using some form of concurrency), or whether you could just do it from a single long-lasting process.
I am trying to create a background processor windows service using hangfire.
I would like to increase the recurring job polling interval to more than 1 minute(hard-coded by default). The reason for doing the same is that recurring polling can affect the performance of the database.
Is there a possibility to enable/disable the hangfire recurring Job feature. This is required in case there are multiple instances of the service installed.
When you create a recurring job in Hangfire, even if you have multiple Hangfire servers, the job will not be run on two servers at the same time.
You can use Cron expression to define the frequency at which to run your job, as described in Hangfire docs:
RecurringJob.AddOrUpdate(() => YourJob(), "0 12 * */2");
However, your need may be to avoid triggering a job when the previous instance is still running. For this situation, I would recommend setting a flag (in the DB for example) when your job starts and removing it when it ends. Then check if the flag is present before actually starting your process.
Update
As you stated you want to prevent the RecurringJobScheduler from running on some servers, I have looked into the code and it seems there is no option to do this.
You can check the file BackgroundJobServer.cs where the scheduler is added to the process list and the RecurringJobScheduler.cs where the DB is queried. The value of 1 minute is hardcoded, as specified in the comments.
I think your only option is the pull request you have already made :(