Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
Timeloop is a service that can be used to run periodic tasks after a certain interval.
Each job runs on a separate thread and when the service is shut down, it waits till all tasks currently being executed are completed.
Inspired by this blog here
pip install timeloop
import time
from timeloop import Timeloop
from datetime import timedelta
tl = Timeloop()
@tl.job(interval=timedelta(seconds=2))
def sample_job_every_2s():
print "2s job current time : {}".format(time.ctime())
@tl.job(interval=timedelta(seconds=5))
def sample_job_every_5s():
print "5s job current time : {}".format(time.ctime())
@tl.job(interval=timedelta(seconds=10))
def sample_job_every_10s():
print "10s job current time : {}".format(time.ctime())
By default timeloop starts in a separate thread.
Please do not forget to call tl.stop
before exiting the program, Or else the jobs wont shut down gracefully.
tl.start()
while True:
try:
time.sleep(1)
except KeyboardInterrupt:
tl.stop()
break
Doing this will automatically shut down the jobs gracefully when the program is killed, so no need to call tl.stop
tl.start(block=True)
Email me with any queries: sankalpjonna@gmail.com.
FAQs
An elegant way to run period tasks.
We found that timeloop demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.