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 ...
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 ...
5
votes
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.
...
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.
...
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 ...
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 ...
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
<...
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 ...
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 ...
3
votes
Accepted
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.
...
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 ...
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.
...
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 ...
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? ...
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&...
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 ...
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 ...
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'...
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.
...
2
votes
Python 3 PriorityDeque with absolute priorities
Just reviewing the docstring for the push method:
...
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 ...
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 ...
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 ...
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 ...
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.
...
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.
...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scheduled-tasks × 74c# × 22
python × 13
java × 12
multithreading × 12
timer × 10
c++ × 8
datetime × 8
async-await × 7
c++11 × 6
performance × 5
concurrency × 5
observer-pattern × 5
beginner × 4
python-3.x × 3
file-system × 3
windows × 3
email × 3
powershell × 3
.net-core × 3
c × 2
ruby × 2
design-patterns × 2
python-2.x × 2
bash × 2