'Flush the database.'

@utils.Synchronized
def Flush(self):

    if self.conn:
        try:
            self.conn.commit()
        except sqlite3.OperationalError:
            pass
    if (self.deleted >= self.next_vacuum_check):
        if (self._NeedsVacuum() and (not self._HasRecentVacuum())):
            self.Vacuum()
            self.deleted = 0
            self.next_vacuum_check = max(config.CONFIG['SqliteDatastore.vacuum_check'], (self.next_vacuum_check / 2))
        else:
            self.next_vacuum_check *= 2
