File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -11,20 +11,21 @@ class TestActorEvents:
11
11
async def test_interval_events (self , make_actor : ActorFactory ) -> None :
12
12
async def main () -> None :
13
13
import os
14
+ from typing import Any , Callable
14
15
15
16
from apify .consts import ActorEventType , ApifyEnvVars
16
17
17
18
os .environ [ApifyEnvVars .PERSIST_STATE_INTERVAL_MILLIS ] = '900'
18
19
19
- def on_event (event_type ): # type: ignore
20
- async def log_event (data ): # type: ignore
20
+ def on_event (event_type : ActorEventType ) -> Callable :
21
+ async def log_event (data : Any ) -> None :
21
22
await Actor .push_data ({'event_type' : event_type , 'data' : data })
22
23
return log_event
23
24
24
25
async with Actor :
25
- Actor .on (ActorEventType .SYSTEM_INFO , on_event (ActorEventType .SYSTEM_INFO )) # type: ignore
26
- Actor .on (ActorEventType .PERSIST_STATE , on_event (ActorEventType .PERSIST_STATE )) # type: ignore
27
- await asyncio .sleep (3 )
26
+ Actor .on (ActorEventType .SYSTEM_INFO , on_event (ActorEventType .SYSTEM_INFO ))
27
+ Actor .on (ActorEventType .PERSIST_STATE , on_event (ActorEventType .PERSIST_STATE ))
28
+ await asyncio .sleep (10 )
28
29
29
30
actor = await make_actor ('actor-interval-events' , main_func = main )
30
31
You can’t perform that action at this time.
0 commit comments