feat: get_paper_meta_from_openalex 添加软停止
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
4090ce457d
commit
1d8d829797
|
|
@ -112,19 +112,20 @@ def get_paper_meta_from_openalex(publication_year:int, keywords:str="", search:s
|
||||||
papers.append(paper)
|
papers.append(paper)
|
||||||
Paper.objects.bulk_create(papers, ignore_conflicts=True)
|
Paper.objects.bulk_create(papers, ignore_conflicts=True)
|
||||||
cache.set(cache_key, next_cursor, timeout=None)
|
cache.set(cache_key, next_cursor, timeout=None)
|
||||||
if end_year is None:
|
if cache.get("get_paper_meta_from_openalex_stop") is not None:
|
||||||
end_year = datetime.now().year
|
if end_year is None:
|
||||||
if publication_year + 1 <= end_year:
|
end_year = datetime.now().year
|
||||||
current_app.send_task(
|
if publication_year + 1 <= end_year:
|
||||||
"apps.resm.tasks.get_paper_meta_from_openalex",
|
current_app.send_task(
|
||||||
kwargs={
|
"apps.resm.tasks.get_paper_meta_from_openalex",
|
||||||
"publication_year": publication_year + 1,
|
kwargs={
|
||||||
"keywords": keywords,
|
"publication_year": publication_year + 1,
|
||||||
"search": search,
|
"keywords": keywords,
|
||||||
"end_year": end_year
|
"search": search,
|
||||||
},
|
"end_year": end_year
|
||||||
countdown=5
|
},
|
||||||
)
|
countdown=5
|
||||||
|
)
|
||||||
|
|
||||||
# 常用的 User-Agent 列表
|
# 常用的 User-Agent 列表
|
||||||
USER_AGENTS = [
|
USER_AGENTS = [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue