Skip to content
Snippets Groups Projects
Commit 14949c85 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

#36 - allow tiles to disable automatic refresh by using "-1" as intervalInSeconds

parent 88d3d5ce
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,7 @@ The following snippet shows an example of a tile in the settings files.
- `tileType` - References the name of a tile class. This class must exist on start of the server.
- `uniqueName` - This name must be unique across the complete page.
- `intervalInSeconds` - Specifies the automatic refresh rate in seconds.
- `intervalInSeconds` - Specifies the automatic refresh rate in seconds (Use `-1` to disable automatic refresh).
- `x` - Horizontal position in the grid, starting by 0 (**Note:** Positions should not be assigned more than once!)
- `y` - Vertical position in the grid, starting by 0 (**Note:** Positions should not be assigned more than once!)
- `width` - The tile's width (minimum is 1 maximum is 12 on desktop horizontal screens)
......
......@@ -35,10 +35,16 @@ class TileScheduler:
LOGGER.warning(f'Tile "{fullName}" already registered')
return
seconds = tile.get_intervalInSeconds()
nextRunTime = datetime.now()
if seconds == -1: # disable automatic refresh
seconds = 9999999999 # 317 years
nextRunTime = None # job is paused
job = self.__scheduler.add_job(tile.update, 'interval',
[pageName],
seconds=tile.get_intervalInSeconds(),
next_run_time=datetime.now())
seconds=seconds,
next_run_time=nextRunTime)
self.__jobs[fullName] = job
self.__cache[fullName] = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment