mirror of
https://codeberg.org/Reuh/feather.git
synced 2025-10-27 10:09:32 +00:00
feat: stop daemon on SIGTERM
This commit is contained in:
parent
0d0cd491ec
commit
07e0e0be9f
3 changed files with 10 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ After changing the configuration, you can call `feather regenerate` to regenerat
|
|||
|
||||
### Docker
|
||||
|
||||
`podman run -d -v ./config.toml:/feather/config.toml -v ./data:/feather/data -v ./reader:/feather/reader --name feather feather daemon`
|
||||
`podman run -d -v ./config.toml:/feather/config.toml -v feather-data:/feather/data -v ./reader:/feather/reader --name feather feather daemon`
|
||||
|
||||
### Raw
|
||||
|
||||
|
|
@ -52,3 +52,4 @@ After changing the configuration, you can call `feather regenerate` to regenerat
|
|||
- [x] Command to force regenerate all HTML files (incl. recompute datetimes & paths)
|
||||
- [x] Handle item updates
|
||||
- [ ] Actually think about the issues created by the duplicate warning
|
||||
- [ ] Set generated files creation/modification date instead of putting date in filename
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ template = '''
|
|||
</head>
|
||||
<body style="background-color:black; color:white;">
|
||||
<style>a{color:palevioletred; text-decoration:none;}</style>
|
||||
<article style="max-width:60rem; margin:auto;">
|
||||
<article style="max-width:60rem; margin:auto; text-align:justify;">
|
||||
<p style="display:flex; flex-direction:row; justify-content:space-between;">
|
||||
<span>{{ published_formatted }}</span>
|
||||
<span><a href="{{ origin_url }}">{{ origin_title }}</a></span>
|
||||
|
|
|
|||
9
main.py
9
main.py
|
|
@ -8,6 +8,7 @@ import tomllib
|
|||
import sys
|
||||
import argparse
|
||||
import asyncio
|
||||
import signal
|
||||
from datetime import datetime
|
||||
from zoneinfo import ZoneInfo
|
||||
from pathlib import Path
|
||||
|
|
@ -276,8 +277,12 @@ async def daemon_sync_down_loop(config, client_session):
|
|||
async def daemon(config, client_session):
|
||||
print(f"Started in daemon mode; changes will be downloaded from the server every {config.daemon_sync_down_every}s and uploaded every {config.daemon_sync_up_every}s")
|
||||
async with asyncio.TaskGroup() as tg:
|
||||
tg.create_task(daemon_sync_up_loop(config, client_session))
|
||||
tg.create_task(daemon_sync_down_loop(config, client_session))
|
||||
tup = tg.create_task(daemon_sync_up_loop(config, client_session))
|
||||
tdown = tg.create_task(daemon_sync_down_loop(config, client_session))
|
||||
def cancel_tasks():
|
||||
tup.cancel()
|
||||
tdown.cancel()
|
||||
asyncio.get_running_loop().add_signal_handler(signal.SIGTERM, cancel_tasks)
|
||||
|
||||
def regenerate_files(config):
|
||||
for json_path in config.json_root.glob("*.json"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue