def run(self):
if not self._should_auto_commit and not self._should_auto_send:<EOL><INDENT>return<EOL><DEDENT>last_send, last_commit = <NUM_LIT:0>, <NUM_LIT:0><EOL>while not self._stopped:<EOL><INDENT>if self._should_auto_commit:<EOL><INDENT>if last_commit > self._commit_interval:<EOL><INDENT>self._docman.commit()<EOL>last_send, last_commit = <NUM_LIT:0>, <NUM_LIT:0><EOL>if self._stopped:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>if self._should_auto_send:<EOL><INDENT>if last_send > self._send_interval:<EOL><INDENT>self._docman.send_buffered_operations()<EOL>last_send = <NUM_LIT:0><EOL><DEDENT><DEDENT>time.sleep(self._sleep_interval)<EOL>last_send += self._sleep_interval<EOL>last_commit += self._sleep_interval<EOL><DEDENT>
Periodically sends buffered operations and/or commit.