FogBugz 7 Online Help

FogBugz Maintenance Service overview

FogBugz does almost all its work through the web, via a web-based interface. That means that FogBugz code won't run until a user requests a web page in their browser.

Typically, web-based interfaces have two problems:

  1. Operations which take a long time make the user wait and result in a non-responsive UI
  2. Operations can only be initiated when a user hits a web page; that makes it impossible to perform routine tasks, for example, deleting old spam at midnight or sending out the morning escalation report via email.

To address these issues FogBugz requires the FogBugz Maintenence Service (informally known as "the heartbeat") to be running at all times. This service's entire job is to wake up every few seconds and hit a web page, specifically, heartbeat.asp (heartbeat.php on non-windows installations). That web page checks if there's any maintenance work to be done, and, if there is, does it.

The FogBugz Maintenence Service is responsible for the following tasks:

  1. Receiving incoming email via POP3 and/or IMAP.
  2. Sending outgoing email from the FogBugz outgoing mail queue (a table named MailQueue) using SMTP.
  3. Performing the Bayesian learning algorithm, which can be slow, after someone has reclassified an email message or discussion group topic.
  4. Deleting old spam messages permanently
  5. Sending the daily email escalation report to any subscribers

If any of these tasks are not happening, it may be because the FogBugz Maintenence Service is not running. If the page heartbeat.asp has not been hit for a long time, FogBugz takes this as a sign that something is wrong with the FogBugz Maintenence Service and reports an error to the next administrator who logs on.

When the Maintenence Service goes to the page heartbeat.asp, heartbeat.asp picks a single task from its list of outstanding work and performs it. Then it checks if there is more work. If there is, it returns + to the Maintenence Service. If there is no more work, it returns - to the Maintenence Service.

The Maintenence Service then goes to sleep for a while so as not to hog all the CPU time. Here's how long it sleeps: