1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Fixed daily execution of tasks for different timezones

This commit is contained in:
Krateng 2020-12-12 17:23:29 +01:00
parent 75d8251a29
commit 64bb235011
4 changed files with 9 additions and 14 deletions

View File

@ -15,7 +15,7 @@ links = {
requires = [
"bottle>=0.12.16",
"waitress>=1.3",
"doreah>=1.6.10",
"doreah>=1.6.13",
"nimrodel>=0.6.4",
"setproctitle>=1.1.10",
"wand>=0.5.4",

View File

@ -71,10 +71,8 @@ CHARTS_DISPLAY_TILES = false
# prevent visitors from mindlessly clicking on those options and hogging your cpu
DISCOURAGE_CPU_HEAVY_STATS = false
# Use system timezone by default. Otherwise specify as either:
# offset in hours IE 0 = UTC, -5 = EST
# IANA time zone IE America/New_York = EST
TIMEZONE = None
# Offset in hours to UTC
TIMEZONE = 0
[Fluff]

View File

@ -57,9 +57,6 @@ config(
caching={
"folder": datadir("cache")
},
regular={
"autostart": False
},
auth={
"multiuser":False,
"cookieprefix":"maloja",
@ -74,6 +71,10 @@ settingsconfig._readpreconfig()
config(
logging={
"logfolder": datadir("logs") if get_settings("LOGGING") else None
},
regular={
"autostart": False,
"offset": get_settings("TIMEZONE")
}
)

View File

@ -6,13 +6,9 @@ from os.path import commonprefix
import math
from doreah.settings import get_settings
# use system timezone as default
# https://stackoverflow.com/a/39079819/1469797
TIMEZONE = datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo
# if user specifies a timezone in settings then try to use that instead
OFFSET = get_settings("TIMEZONE")
if OFFSET is not None:
TIMEZONE = timezone(timedelta(hours=OFFSET))
TIMEZONE = timezone(timedelta(hours=OFFSET))
FIRST_SCROBBLE = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp())