Skip to content
Snippets Groups Projects
Commit ebe0e8de authored by David Trattnig's avatar David Trattnig
Browse files

Fix playlog storage. engine-clock#1

parent d0c03d5e
No related branches found
No related tags found
No related merge requests found
......@@ -94,8 +94,8 @@ class PlayLog(db.Model):
db.session.commit()
now = datetime.datetime.now()
track = db.session.query(PlayLog).\
filter(PlayLog.track_start <= str(now)).\
order_by(PlayLog.track_start.desc()).first()
order_by(PlayLog.track_start.desc()).\
filter(PlayLog.track_start <= str(now)).first()
if track:
if track.track_start + datetime.timedelta(0,track.track_duration) > now:
......
......@@ -150,9 +150,6 @@ class ApiService():
if not data.log_source:
data.log_source = self.config.get("host_id")
if self.config.get("enable_federation") == "false":
return
# Main Node: Alway log entry, independed of the source
# Sync Node: Only log entry when it's coming from an active source
if self.node_type == NodeType.MAIN or \
......@@ -165,6 +162,9 @@ class ApiService():
except sqlalchemy.exc.IntegrityError as e:
self.logger.info("Playlog for '%s' is already existing in local database. Skipping..." % data.track_start)
if self.config.get("enable_federation") == "false":
return
# Main Node: Push to Sync Node, if enabled
if self.node_type == NodeType.MAIN and self.sync_host and self.api_playlog:
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment