Treadsafe startup timestamp, #build

Changed:
- Fixed startup timestamp writing, move to ta_startap in single thread
- Bump frontend dependencies
This commit is contained in:
Simon 2025-11-02 11:29:40 +07:00
commit 80c823ca41
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
3 changed files with 388 additions and 373 deletions

View File

@ -52,6 +52,7 @@ class Command(BaseCommand):
self._create_default_schedules()
self._update_schedule_tz()
self._init_app_config()
self._set_ta_startup_time()
self._mig_fix_download_channel_indexed()
self._mig_add_default_playlist_sort()
self._mig_set_channel_tabs()
@ -259,6 +260,17 @@ class Command(BaseCommand):
self.style.SUCCESS(f" Status code: {status_code}")
)
def _set_ta_startup_time(self) -> None:
"""set startup time to trigger frontend refresh, threadsafe"""
self.stdout.write("[11] Set startup timestamp")
message = str(int(datetime.now().timestamp() // 10 * 10))
RedisArchivist().set_message(
"STARTTIMESTAMP", message=message, save=True
)
self.stdout.write(
self.style.SUCCESS(f" ✓ set timestamp to {message}.")
)
def _mig_fix_download_channel_indexed(self) -> None:
"""migrate from v0.5.2 to 0.5.3, fix missing channel_indexed"""
self.stdout.write("[MIGRATION] fix incorrect video channel tags types")

View File

@ -11,12 +11,12 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import hashlib
from datetime import datetime
from os import environ, path
from pathlib import Path
from common.src.env_settings import EnvironmentSettings
from common.src.helper import ta_host_parser
from common.src.ta_redis import RedisArchivist
from corsheaders.defaults import default_headers
try:
@ -228,7 +228,11 @@ CORS_EXPOSE_HEADERS = ["X-Start-Timestamp"]
# TA application settings
TA_UPSTREAM = "https://github.com/tubearchivist/tubearchivist"
TA_VERSION = "v0.5.8-unstable"
TA_START = str(int(datetime.now().timestamp() // 10 * 10)) # round it
try:
TA_START = RedisArchivist().get_message_str("STARTTIMESTAMP")
except ValueError:
# fails in unittests bootstrap
pass
# API
REST_FRAMEWORK = {

File diff suppressed because it is too large Load Diff