Skip to main content
8 votes
Accepted

Implement a job scheduler which takes in a function f and an integer n, and calls f after n milliseconds

Imports Use import java.util.Timer; and import java.util.TimerTask; at the top of the file. This will allow you to simplify ...
AJNeufeld's user avatar
  • 34k
8 votes
Accepted

Simple async task scheduler

No way to stop the cycle. The standard with TPL is to use the CancellationToken. Even if it is not need now, which I don't know why, it would be easier in the future if it supported it. For example ...
CharlesNRice's user avatar
  • 4,408
5 votes

C++ Task Scheduler

Consider this improved version of Yuushi's code: ...
Prescornic Andrei's user avatar
5 votes
Accepted

Scheduling using System.IObservable 2.0

1) int as time interval is ambiguous. TimeSpan is not. So I would use the latter. ...
Nikita B's user avatar
  • 13k
5 votes

Simple async task scheduler

Keep a single var now = DateTime.UtcNow; Initialize the check-tasks to Task.CompletedTask to get rid of all the null checks. ...
Johnbot's user avatar
  • 3,004
4 votes
Accepted

Task scheduler with dependencies

Here are some things that may help you improve your code. Be careful with signed and unsigned In the doit routine and various others, the code compares an ...
Edward's user avatar
  • 66.6k
4 votes
Accepted

A priority based timer using priority queue

any corner cases that I forgot to take into account No error handling e.g.: malloc() may return NULL. any design approach that ...
chux's user avatar
  • 33.6k
3 votes
Accepted

Bash on Synology - Delete recycle bin entries over X days old

If this is intended to be run as a command, I recommend you add a suitable shebang line. Although the question is tagged bash, there's nothing here that isn't portable POSIX shell, so I recommend <...
Toby Speight's user avatar
  • 81.7k
3 votes
Accepted

Periodically sending data from database to an API

If Dowork takes longer than 15 seconds to execute, it will be called a second time. Will this cause issues? One way around that would be to disable the timer ...
1201ProgramAlarm's user avatar
3 votes

Periodically synching data from an API to database is extremely slow

Error handling if response.status_code != 200: print('api response error: {}'.format(response)) return is better represented as a simple call to ...
Reinderien's user avatar
  • 65.3k
3 votes
Accepted

Scheduler built with observables

...
Xiaoy312's user avatar
  • 3,136
3 votes

Process monitoring script

Don't write custom scripts for common sysadmin tasks. Using the proper tools will get the job done better, and the solution will be more maintainable — especially by any colleagues you might have. ...
200_success's user avatar
3 votes

Timer for scheduling tasks in C++11

Your usage of std::ref is unnecessary (both in main and invoke). It is only needed when you ...
kmdreko's user avatar
  • 461
3 votes

Start task as soon as multiple tasks are successful

Well, whatever you do, you should only re-check those sources which have not finished, so you should remember which have finished already, or equivalently, only those which have not. ...
Graipher's user avatar
  • 41.1k
3 votes

Schedule Checker

Specific suggestions You can pull out variables for the several repeated calls (such as str2datetime(currentStart)) to massively simplify the code. The idiomatic ...
l0b0's user avatar
  • 8,977
3 votes

A priority based timer using priority queue

Code structure There are three important components here Priority queue Scheduler Timer Scheduler picks up timer based on priority queue and fires. Should priority queue know about details of Timer? ...
nkvns's user avatar
  • 389
3 votes

Simple priority task scheduler implementation

predictable ordering In your problem Specifications you included if a burst of high priority messages is sent, they should not completely starve lower priority messages (in this regard "priority&...
J_H's user avatar
  • 34.9k
2 votes

Parallel Task Queue that runs in sequence

Task Parallel Library (TPL) I believe you are reinventing the wheel here. TPL provides numerous ways of synchronizing tasks. For instance, it allows you to: create a task scheduler from current ...
dfhwze's user avatar
  • 13.9k
2 votes

ObservingCache - scheduled task executor that returns a result

Class is open to modification ObservingCache should be closed for modification, this is the OCP principle. If it's not, its behaviour can be altered (by ...
Spotted's user avatar
  • 599
2 votes

Python library for calculating next and previous time of the cron-like scheduled task

In general, you want to avoid using type(x) == SomeType. This is because Python relies quite often on duck-typing (If it looks like a duck, quacks like a duck...it'...
Graipher's user avatar
  • 41.1k
2 votes

Process monitoring script

Although @200_success already gave a great answer, there are some glaring issues with the posted code that should be pointed so you can avoid them in the future. ...
janos's user avatar
  • 112k
2 votes

Python 3 PriorityDeque with absolute priorities

Just reviewing the docstring for the push method: ...
Gareth Rees's user avatar
  • 49.7k
2 votes

Streaming scheduled TV shows according to a CSV playlist

I'd start with a few specific points for the code style. Consistent naming. You are mixing snake_case and camelCase. Check the ...
hjpotter92's user avatar
  • 8,791
2 votes

Promise-based fixed delay poller with timeout

Polling is not good. I'm curious if there is a more idiomatic or flexible way for this to be written. Generally polling for a state change is not considered best practice so there is no idiomatic ...
Blindman67's user avatar
  • 22.3k
2 votes
Accepted

Sleep until specified time

In a program comment it is said that the program # Accepts any date/time format accepted by 'date' That information should be printed with the usage help, plus ...
Martin R's user avatar
  • 23.5k
2 votes

Bash on Synology - Delete recycle bin entries over X days old

I think the modified date doesn't change when the file is moved to #Recycle area, so if the file is already older than 60 days, it will deleted the next time the script runs. I have observed that the ...
Darren Tooten's user avatar
2 votes

Simple python scheduled tasks script that runs once daily

You can get rid of doing any I/O and make your code cleaner in the process. ...
FirefoxMetzger's user avatar
2 votes

Function to call a list of callables with retry

You are not allowed to remove items from a list while iterating over the list. ...
AJNeufeld's user avatar
  • 34k
2 votes

Scheduled file sorting with Ruby

Your program is over-engineered in a way that makes it hard to decipher. Because every method is one line long, it's like reading a poem whose lines have been scrambled. You would be much better off ...
200_success's user avatar
2 votes
Accepted

Reload polyline midpoints into parallel tables

I don't have any experience with arcpy, so possibly some of this may be invalid. Mostly the code is very good: It's concise; it's clear enough what it does without lot's of documentation, and it has ...
ShapeOfMatter's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible