File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,7 @@ class UserOrgInfoOut(BaseModel):
244244 "paused_time_quota_reached" ,
245245 "paused_org_readonly" ,
246246]
247+ AUTO_PAUSED_STATES = get_args (TYPE_AUTO_PAUSED_STATES )
247248
248249TYPE_PAUSED_STATES = Literal [
249250 TYPE_MANUALLY_PAUSED_STATES ,
Original file line number Diff line number Diff line change 2222 TYPE_RUNNING_STATES ,
2323 TYPE_ALL_CRAWL_STATES ,
2424 TYPE_PAUSED_STATES ,
25+ AUTO_PAUSED_STATES ,
2526 RUNNING_STATES ,
2627 WAITING_STATES ,
2728 RUNNING_AND_STARTING_ONLY ,
@@ -1638,13 +1639,16 @@ async def update_crawl_state(
16381639 allowed_from = RUNNING_AND_WAITING_STATES ,
16391640 )
16401641
1641- # TODO: This is reached several times, so make it idempotent
1642- if paused_state != "paused" :
1642+ if (
1643+ paused_state in AUTO_PAUSED_STATES
1644+ and not status .autoPausedEmailsSent
1645+ ):
16431646 await self .crawl_ops .notify_org_admins_of_auto_paused_crawl (
16441647 paused_reason = paused_state ,
16451648 cid = crawl .cid ,
16461649 org = crawl .org ,
16471650 )
1651+ status .autoPausedEmailsSent = True
16481652
16491653 return status
16501654
Original file line number Diff line number Diff line change @@ -257,3 +257,6 @@ class CrawlStatus(BaseModel):
257257
258258 # last state
259259 last_state : TYPE_ALL_CRAWL_STATES = Field (default = "starting" , exclude = True )
260+
261+ # email sent to org admins because crawl was auto-paused
262+ autoPausedEmailsSent : bool = False
You can’t perform that action at this time.
0 commit comments