Skip to content

Commit 6b228bc

Browse files
committed
Fix incremental fetch problem for p2o
Signed-off-by: theSalt <[email protected]>
1 parent efd60e3 commit 6b228bc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

grimoire_elk/elk.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,20 @@ def enrich_backend(url, clean, backend_name, backend_params, cfg_section_name,
483483
enrich_backend.set_params(backend_params)
484484
# store the cfg section name in the enrich backend to recover the corresponding project name in projects.json
485485
enrich_backend.set_cfg_section_name(cfg_section_name)
486-
enrich_backend.set_from_date(last_enrich_date)
486+
487487
if url_enrich:
488488
elastic_enrich = get_elastic(url_enrich, enrich_index, clean, enrich_backend, es_enrich_aliases)
489489
else:
490490
elastic_enrich = get_elastic(url, enrich_index, clean, enrich_backend, es_enrich_aliases)
491491
enrich_backend.set_elastic(elastic_enrich)
492+
493+
# if last_enrich_date is None, get it from metadata__timestamp
494+
if not last_enrich_date:
495+
last_enrich_date = elastic_enrich.get_last_item_field("metadata__timestamp")
496+
if last_enrich_date:
497+
last_enrich_date = last_enrich_date.replace(tzinfo=None)
498+
enrich_backend.set_from_date(last_enrich_date)
499+
492500
if jenkins_rename_file and backend_name == "jenkins":
493501
enrich_backend.set_jenkins_rename_file(jenkins_rename_file)
494502
if unaffiliated_group:

0 commit comments

Comments
 (0)