Using FogBugz On Demand? We've recently rolled out a new sidebar as part of taking FogBugz forward. Please see this article for details on what's new, what's changed, and where you can find all your favorite things.

The FogBugz Maintenance Service runs every 15 seconds. It is responsible for doing all the work that is not done by a user in the web interface. For instance, if someone sends you an email, you want FogBugz to import it in the background.

The FogBugz Maintenance Service determines what URL to hit by the configuration setting at Admin -> Site Configuration -> Advanced:

maintenance_url

The service constructs the URL by appending /heartbeat.asp and will hit it at least once every 15 seconds. You can load this page in a browser to do the exact same thing the service does, but be careful of conflicting with its operation. If you load heartbeat.asp in your browser and see the message…

# Heartbeat is locked. If you are sure there are no other processes running heartbeat, you can break the lock and reload heartbeat

you should load the page again until you don’t clash with the existing lock.

The loading of the heartbeat page does the following list of tasks. Some of them are not run every heartbeat, like daily tasks. Some of them might not be fully completed in one heartbeat, like search indexing.

If heartbeat completes all the work it needs to do, it returns a single minus sign (-). If there’s more work to be done, it returns a (+). The service adjusts how frequently it comes back based on this + or -, and based on how long the page took to load. If the page took a long time to load, the service will wait a while before coming back. That’s because we don’t want to compete with users for system resources.

Here’s a list of what the heartbeat does:

  1. Bayesian Training
  2. Backfills (Database normalization, like setting the ixBugEventLatest in the Bug table to the actual latest BugEvent for that case.)
  3. Check POP3 Mailboxes
  4. Daily tasks like sending the Escalation Report
  5. Send outgoing mail from the MailQueue table
  6. Search Indexing
  7. Schedule Maintenance
  8. Plugin heartbeat tasks (depends on the plugins you have installed)
  9. Minor Cleanup

DEBUGGING

Available as of FogBugz 7.1.8.

If you’re debugging this service, use the following flags to skip a given part of heartbeat. These flags can be set in the registry, as strings, REG_SZ (HKLM\SOFTWARE\Fog Creek Software\FogBugz\c:/yourfogbugz/website) or as a part of the request to heartbeat (e.g. http://localhost/heartbeat.asp?fSkipDailyTasks=1&fSkipFulltextIndexer=1).

Here’s a list off all available flags:

  • fSkipCDBCopier
  • fSkipBayesianTraining
  • fSkipHeartbeatTasks
  • fSkipIncomingHostedEmails
  • fSkipDailyTasks
  • fSkipMailQueue
  • fSkipFulltextIndexer
  • fSkipScheduleMaint
  • fSkipPluginHeartbeatTasks
  • fSkipInstallDefaultPlugins

Heartbeat will skip a given step if the flag is to true in either location (e.g. heartbeat will still skip daily tasks, if fSkipDailyTasks is “1” in the registry and “0” in the request or vice versa).