Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 138 #139

Merged
merged 6 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -43,7 +43,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
2 changes: 1 addition & 1 deletion .github/workflows/tests_mergin_db_sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
python3 -m pip install mergin-client pytest pytest-cov dynaconf psycopg2

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Run tests
run: |
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
9 changes: 2 additions & 7 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

License: MIT
"""

import pytest

from config import ConfigError, config, get_ignored_tables, validate_config
from smtp_functions import can_send_email

from .conftest import _reset_config

Expand Down Expand Up @@ -255,9 +255,7 @@ def test_get_ignored_tables():
def test_config_notification_setup():
_reset_config()

# no NOTIFICATIONS set should pass but cannot send email
validate_config(config)
assert can_send_email(config) is False

# incomplete setting
config.update(
Expand Down Expand Up @@ -326,7 +324,7 @@ def test_config_notification_setup():
}
)

with pytest.raises(ConfigError, match="Config error: `smtp_port` must be set an integer"):
with pytest.raises(ConfigError, match="Config error: `smtp_port` must be set to an integer"):
validate_config(config)
# complete setting but does not work
config.update(
Expand All @@ -347,6 +345,3 @@ def test_config_notification_setup():

with pytest.raises(ConfigError, match="Config SMTP Error"):
validate_config(config)

# notifications are set, emails can be send - but this config was not validated, as it would be in real run
assert can_send_email(config)
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"
Loading