Skip to content

Commit 707fc4f

Browse files
docs: Edit PPR python example
1 parent 65ce975 commit 707fc4f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sources/platform/actors/publishing/monetize/pay_per_result.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export const pushDataMaxAware = async (data: Parameters<Actor['pushData']>[0]):
118118

119119
```python
120120
import os
121+
import asyncio
121122
from apify import Actor
122123
from typing import Union, List, Dict, Any
123124

@@ -143,9 +144,9 @@ class PayPerResultManager:
143144
self.is_getting_item_count = False
144145
self.is_initialized = True
145146

146-
# Others handlers will wait until initialized which should be few milliseconds
147+
# Wait until initialized
147148
while not self.is_initialized:
148-
await Actor.sleep(0.05)
149+
await asyncio.sleep(0.05) # 50ms
149150

150151
data_as_array = data if isinstance(data, list) else [data]
151152
data_to_push = data_as_array[:self.max_items - self.pushed_item_count]

0 commit comments

Comments
 (0)