#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def _on_shutdown( self ) : #NEWLINE# #INDENT# "Gets called when shutting down. This lets us persist any updates that\n        we haven't yet persisted, e.g. updates that only changes some internal\n        timers. This allows changes to persist across startup without having to\n        persist every single change.\n\n        If this does not run it simply means that some of the timers will fire\n        earlier than they should when synapse is restarted. This affect of this\n        is some spurious presence changes that will self-correct.\n        " #NEWLINE# logger . info ( 'Performing _on_shutdown. Persiting %d unpersisted changes' , len ( self . user_to_current_state ) ) #NEWLINE# if self . unpersisted_users_changes : #NEWLINE# #INDENT# ( yield self . store . update_presence ( [ user_id . user_to_current_state [ user_id ] for user_id in self . unpersisted_users_changes ] ) ) #NEWLINE# #UNINDENT# logger . info ( 'Finished _on_shutdown' )