Skip to content

Commit

Permalink
Fix #138 (#139)
Browse files Browse the repository at this point in the history
* convert datetime.timedelta to seconds before comparison

* bump version

* remove function from tests

* update actions to avoid warnings

* fix error

---------

Co-authored-by: Jan Caha <[email protected]>
  • Loading branch information
JanCaha and Jan Caha authored Sep 4, 2024
1 parent b84d41d commit 8f7e082
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:

steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: robinraju/release-downloader@v1.8
- uses: robinraju/release-downloader@v1.10
with:
repository: "MerginMaps/geodiff"
latest: true
Expand All @@ -26,7 +26,7 @@ jobs:
cd scripts/windows_binaries
del geodiff_*.zip
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand All @@ -44,7 +44,7 @@ jobs:
run: copy config.yaml.default scripts/dist/config.yaml

- name: Upload Zip file as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dbsync_standalone_win
path: scripts/dist
1 change: 0 additions & 1 deletion .github/workflows/tests_mergin_db_sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ jobs:
python3 -m pip install -r requirements.txt
python3 -m pip install -r requirements-dev.txt
- name: Run tests
run: |
pytest test --cov=. --cov-report=term-missing:skip-covered -vv
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.1.2

- Fix datetime.timedelta comparison to seconds

## 2.1.1

- Fix failure to start when notifications were not enabled
Expand Down
5 changes: 4 additions & 1 deletion dbsync_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ def main():
else:
min_time_delta_hr = 4

if last_email_sent is None or (datetime.datetime.now() - last_email_sent) > min_time_delta_hr * 3600:
if (
last_email_sent is None
or (datetime.datetime.now() - last_email_sent).total_seconds() > min_time_delta_hr * 3600
):
send_email(str(e), config)
last_email_sent = datetime.datetime.now()

Expand Down
2 changes: 1 addition & 1 deletion test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
License: MIT
"""

import pytest

from config import ConfigError, config, get_ignored_tables, validate_config
Expand Down Expand Up @@ -254,7 +255,6 @@ def test_get_ignored_tables():
def test_config_notification_setup():
_reset_config()

# no NOTIFICATIONS set should pass but cannot send email
validate_config(config)

# incomplete setting
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.1.1"
__version__ = "2.1.2"

0 comments on commit 8f7e082

Please sign in to comment.