Backend & AI

What is APScheduler (scheduled jobs)

What it is

A scheduler inside a Python program: it runs actions at the right time โ€” a reminder at 9 a.m., a check every minute, a report on the 1st. Unlike cron, it lives inside the bot and sees its data.

How we use it

It sends birthday and subscription-expiry reminders, escalations and the monthly report in the help desk, and marks no-shows in the electronic queue. The time zone is always set explicitly to Europe/Moscow.

Where it helps a business

  • A customer should be reminded about a renewal or a birthday in advance, not on the day.
  • A ticket nobody reacts to should be escalated without a person stepping in.
  • A report for management should arrive on the 1st by itself.

How we use it

  • Reminders. The birthday bot checks dates once a day at 9:00 Moscow time and writes 14, 7, 3 and 1 day ahead; the subscription-sales bot reminds about renewal at 10:00, 3 days and 1 day before expiry.
  • Escalation and reports. In the IT help desk: visit reminders, escalation, the morning digest, the monthly report and a weekly database dump.
  • Check-in and no-shows. In the electronic queue event starts are checked every minute, and no-shows are marked by timeout.
  • Housekeeping. Old backups cleaned at 00:30 and database maintenance on Mondays at 03:00.

Common problems

  • Hosting time instead of yours. The scheduler and the container run in an explicitly set Europe/Moscow time zone; otherwise "a reminder at 9 a.m." arrives at a different hour.
  • A once-a-minute check can miss an event. In the electronic queue an event start is looked for within a plus-or-minus two-minute window so the check-in is not missed.

When you do not need it

For a job unrelated to the bot's data, such as a nightly server backup or log rotation, cron on the server itself is enough.

โ† All terms

Need a website, a bot or automation?

Terms explained โ€” now let's get to work: tell us about the task and we'll turn it into a clear work plan.