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 : Counter does not work well on Ingest dashboard for events [SDESK-6681] #2414

Merged
merged 1 commit into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion superdesk/io/commands/update_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import bson
import logging
from datetime import timedelta, timezone, datetime

import pytz
from flask import current_app as app
from werkzeug.exceptions import HTTPException

Expand Down Expand Up @@ -47,6 +47,7 @@
LAST_UPDATED = "last_updated"
LAST_INGESTED_ID = "last_ingested_id"
LAST_ITEM_UPDATE = "last_item_update"
LAST_ITEM_ARRIVED = "last_item_arrived"
IDLE_TIME_DEFAULT = {"hours": 0, "minutes": 0}

UPDATE_TTL = 1800
Expand Down Expand Up @@ -315,6 +316,10 @@ def update_provider(provider, rule_set=None, routing_scheme=None, sync=False):
items = generator.send(failed)
failed = ingest_items(items, provider, feeding_service, rule_set, routing_scheme)
update_last_item_updated(update, items)

if not update.get(LAST_ITEM_ARRIVED) or update[LAST_ITEM_ARRIVED] < datetime.now(tz=pytz.utc):
update[LAST_ITEM_ARRIVED] = datetime.now(tz=pytz.utc)

except StopIteration:
break

Expand Down
1 change: 1 addition & 0 deletions superdesk/io/ingest_provider_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def __init__(self, endpoint_name, app, service, endpoint_schema=None):
"last_updated": {"type": "datetime"},
"last_ingested_id": {"type": "string"}, # this id is ingest provider internal value
"last_item_update": {"type": "datetime"},
"last_item_arrived": {"type": "datetime"},
"rule_set": Resource.rel("rule_sets", nullable=True),
"routing_scheme": Resource.rel("routing_schemes", nullable=True),
"notifications": {
Expand Down