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 ,
@@ -1626,13 +1627,16 @@ async def update_crawl_state(
16261627 allowed_from = RUNNING_AND_WAITING_STATES ,
16271628 )
16281629
1629- # TODO: This is reached several times, so make it idempotent
1630- if paused_state != "paused" :
1630+ if (
1631+ paused_state in AUTO_PAUSED_STATES
1632+ and not status .autoPausedEmailsSent
1633+ ):
16311634 await self .crawl_ops .notify_org_admins_of_auto_paused_crawl (
16321635 paused_reason = paused_state ,
16331636 cid = crawl .cid ,
16341637 org = crawl .org ,
16351638 )
1639+ status .autoPausedEmailsSent = True
16361640
16371641 return status
16381642
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