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)
|
||||
Paper.objects.bulk_create(papers, ignore_conflicts=True)
|
||||
cache.set(cache_key, next_cursor, timeout=None)
|
||||
if end_year is None:
|
||||
end_year = datetime.now().year
|
||||
if publication_year + 1 <= end_year:
|
||||
current_app.send_task(
|
||||
"apps.resm.tasks.get_paper_meta_from_openalex",
|
||||
kwargs={
|
||||
"publication_year": publication_year + 1,
|
||||
"keywords": keywords,
|
||||
"search": search,
|
||||
"end_year": end_year
|
||||
},
|
||||
countdown=5
|
||||
)
|
||||
if cache.get("get_paper_meta_from_openalex_stop") is not None:
|
||||
if end_year is None:
|
||||
end_year = datetime.now().year
|
||||
if publication_year + 1 <= end_year:
|
||||
current_app.send_task(
|
||||
"apps.resm.tasks.get_paper_meta_from_openalex",
|
||||
kwargs={
|
||||
"publication_year": publication_year + 1,
|
||||
"keywords": keywords,
|
||||
"search": search,
|
||||
"end_year": end_year
|
||||
},
|
||||
countdown=5
|
||||
)
|
||||
|
||||
# 常用的 User-Agent 列表
|
||||
USER_AGENTS = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue