Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@crontab('* * * * * *', loop=loop)
@asyncio.coroutine
def t():
raise CustomError()
@crontab('* * * * * *', start=False, loop=loop)
def t():
loop.call_later(1, future.set_result, 1)
raise ValueError()
def test_next():
loop = asyncio.new_event_loop()
def t():
return 1
t = crontab('* * * * * *', func=t, loop=loop)
future = asyncio.ensure_future(t.next(), loop=loop)
loop.run_until_complete(future)
assert future.result() == 1
@aiocron.crontab('*/{} * * * *'.format(CHECK_INTERVAL))
@asyncio.coroutine
def check():
"""Check availability of all observed products."""
global last_check
for shop in SHOP_HANDLERS:
yield from shop.check()
last_check = datetime.utcnow().strftime("%Y/%m/%d-%H:%M")
if any([shop.available for shop in SHOP_HANDLERS]):
log.info('In stock!')
availability.append(True)
yield from notify()
else:
log.info('Out of stock')
def crontab(self, *args, **kwargs):
kwargs['loop'] = self.loop
return aiocron.crontab(*args, **kwargs)
async def initialize(self) -> None:
await self.initialise_game_counter()
await self.update_data()
self._update_cron = aiocron.crontab(
'*/10 * * * *', func=self.update_data
)
await self._message_queue_service.declare_exchange("faf-rabbitmq")
async def initialize(self) -> None:
await self.check_update_geoip_db()
# crontab: min hour day month day_of_week
# Run every Wednesday because GeoLite2 is updated every first Tuesday
# of the month.
self._update_cron = aiocron.crontab(
'0 0 0 * * 3', func=self.check_update_geoip_db
)
self._check_file_timer = Timer(
60 * 10, self.check_geoip_db_file_updated, start=True
)
async def initialize(self) -> None:
if self._task is not None:
self._logger.error("Service already runnning or not properly shut down.")
return
await self.update_data()
self._update_cron = aiocron.crontab("*/10 * * * *", func=self.update_data)
self._accept_input = True
self._logger.debug("RatingService starting...")
self._task = asyncio.create_task(self._handle_rating_queue())
async def initialize(self) -> None:
await self.update_data()
self._update_cron = aiocron.crontab(
'*/10 * * * *', func=self.update_data
)
async def initialize(self) -> None:
# TODO: Starting hardcoded queues here
for queue in self.queues.values():
queue.initialize()
await self.update_data()
self._update_cron = aiocron.crontab('*/10 * * * *', func=self.update_data)
self.start_queue_handlers()