(self, announce=False, check_files=False, since=None)
| 451 | # Return: None |
| 452 | @util.Noparallel() |
| 453 | def update(self, announce=False, check_files=False, since=None): |
| 454 | self.content_manager.loadContent("content.json", load_includes=False) # Reload content.json |
| 455 | self.content_updated = None # Reset content updated time |
| 456 | |
| 457 | if check_files: |
| 458 | self.storage.updateBadFiles(quick_check=True) # Quick check and mark bad files based on file size |
| 459 | |
| 460 | if not self.isServing(): |
| 461 | return False |
| 462 | |
| 463 | self.updateWebsocket(updating=True) |
| 464 | |
| 465 | # Remove files that no longer in content.json |
| 466 | self.checkBadFiles() |
| 467 | |
| 468 | if announce: |
| 469 | self.announce(force=True) |
| 470 | |
| 471 | # Full update, we can reset bad files |
| 472 | if check_files and since == 0: |
| 473 | self.bad_files = {} |
| 474 | |
| 475 | queried = self.checkModifications(since) |
| 476 | |
| 477 | changed, deleted = self.content_manager.loadContent("content.json", load_includes=False) |
| 478 | |
| 479 | if self.bad_files: |
| 480 | self.log.debug("Bad files: %s" % self.bad_files) |
| 481 | gevent.spawn(self.retryBadFiles, force=True) |
| 482 | |
| 483 | if len(queried) == 0: |
| 484 | # Failed to query modifications |
| 485 | self.content_updated = False |
| 486 | self.bad_files["content.json"] = 1 |
| 487 | else: |
| 488 | self.content_updated = time.time() |
| 489 | |
| 490 | self.updateWebsocket(updated=True) |
| 491 | |
| 492 | # Update site by redownload all content.json |
| 493 | def redownloadContents(self): |
no test coverage detected