I'm thinking of the grid data generator, which completes pretty quickly but then still has a lot of work to do in the background. In general, keep track of a queue of tasks to complete - whether they're changes that have been dispatched, or messages to process from peers; and add information to state about whether we're busy or not, and how much is left to do.