DEV Community

Cover image for Chaotic Schedule v1.1 released!
skywarth
skywarth

Posted on

1

Chaotic Schedule v1.1 released!

Hello,

I've released a new version for Chaotic Schedule package. This new release introduces new random scheduling macro: hourlyMultipleAtRandom().

What is Chaotic Schedule?

Github, Packagist

Chaotic Schedule is a Laravel package which allows you to randomize command schedules, be it date or time. Want a sampler for taste of flavor, sure:

$schedule->command('foo:bar')
->weekly()
->randomDays(
RandomDateScheduleBasis::WEEK,
[Carbon::FRIDAY,Carbon::Tuesday,Carbon::Sunday],
1,2
)
->atRandom('14:48','16:54');
Enter fullscreen mode Exit fullscreen mode




Where can you use Chaotic Schedule?

Here's some use-cases which might be valid for you as well:

  • I have a command to send notifications to my clients. But I would like it to be sent at a random time between 14:00 and 17:00
  • I would like to send some gifts to users if they are active between my special event period which is every week Friday and Saturday between 00:00 and 04:20
  • My boss asked me to generate and send statistical reports regarding database activities every month, but only on Monday, Wednesday and Friday. And this report has to be delivered in the morning between 08:00 and 09:30 and I want it to look like I've personally generated and sent it personally. So random time and date is crucial to stage this.
  • I would like to send reminders to customers and I want it to look and feel human. So random run times and dates every week would help me a lot. Otherwise, if I send every week on Tuesday 11:00 they would know this is automated and ignore these.
  • There is a financial deficit, in order to detect the source of it I'll be running audit calculations. But these have to be random, otherwise they'll alter the records accordingly. I need to run audit calculations/assertions 3 times a day at random times.
  • I'm trying to detect certain anomalies in my data, and therefore it would help me a lot to run a command completely randomly but with a minimum of at least 100 times a year.

What's new?

hourlyMultipleAtRandom() can be used for scheduling your commands to run every hour on random minutes. Example use case: I want to run a command every hour, 1-5 times at random, on random minutes. E.g. run minutes:[5,11,32,44]

  • Runs every hour
  • Only designates random run time(s)
  • Runs multiple times per hour, according to $timesMin and $timesMax params
  • Doesn't designate any date on the schedule. So you may have to provide some date scheduling such as daily(), weekly(), mondays() etc.
  • Behaves exactly the same with ->hourlyAtRandom if the timesMin=1 and timesMax=1. (I mean duh)

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more