Update source code if needed.
()
| 172 | |
| 173 | |
| 174 | def update_source_code_if_needed(): |
| 175 | """Update source code if needed.""" |
| 176 | try: |
| 177 | # Update the bot source, if there's a newer version. |
| 178 | newer_source_revision = update_task.get_newer_source_revision() |
| 179 | if newer_source_revision is not None: |
| 180 | # If source code needs update, stop the heartbeat first. As otherwise, |
| 181 | # we can run into exceptions if source code changed from underneath |
| 182 | # a running process. |
| 183 | stop_heartbeat() |
| 184 | |
| 185 | update_task.update_source_code() |
| 186 | except Exception: |
| 187 | logs.error('Failed to update source.') |
| 188 | |
| 189 | |
| 190 | def run_loop(bot_command, heartbeat_command): |
no test coverage detected