|
1 | 1 | import asyncio
|
| 2 | +import contextlib |
2 | 3 | import inspect
|
3 | 4 | import logging
|
4 | 5 | import os
|
@@ -271,28 +272,22 @@ async def _respond_to_migrating_event(self, _event_data: Any) -> None:
|
271 | 272 | # Don't emit any more regular persist state events
|
272 | 273 | if self._send_persist_state_interval_task and not self._send_persist_state_interval_task.cancelled():
|
273 | 274 | self._send_persist_state_interval_task.cancel()
|
274 |
| - try: |
| 275 | + with contextlib.suppress(asyncio.CancelledError): |
275 | 276 | await self._send_persist_state_interval_task
|
276 |
| - except asyncio.CancelledError: |
277 |
| - pass |
278 | 277 |
|
279 | 278 | self._event_manager.emit(ActorEventTypes.PERSIST_STATE, {'isMigrating': True})
|
280 | 279 | self._was_final_persist_state_emitted = True
|
281 | 280 |
|
282 | 281 | async def _cancel_event_emitting_intervals(self) -> None:
|
283 | 282 | if self._send_persist_state_interval_task and not self._send_persist_state_interval_task.cancelled():
|
284 | 283 | self._send_persist_state_interval_task.cancel()
|
285 |
| - try: |
| 284 | + with contextlib.suppress(asyncio.CancelledError): |
286 | 285 | await self._send_persist_state_interval_task
|
287 |
| - except asyncio.CancelledError: |
288 |
| - pass |
289 | 286 |
|
290 | 287 | if self._send_system_info_interval_task and not self._send_system_info_interval_task.cancelled():
|
291 | 288 | self._send_system_info_interval_task.cancel()
|
292 |
| - try: |
| 289 | + with contextlib.suppress(asyncio.CancelledError): |
293 | 290 | await self._send_system_info_interval_task
|
294 |
| - except asyncio.CancelledError: |
295 |
| - pass |
296 | 291 |
|
297 | 292 | @classmethod
|
298 | 293 | async def exit(
|
@@ -1299,8 +1294,8 @@ async def _create_proxy_configuration_internal(
|
1299 | 1294 |
|
1300 | 1295 | if actor_proxy_input is not None:
|
1301 | 1296 | if actor_proxy_input.get('useApifyProxy', False):
|
1302 |
| - country_code = country_code or actor_proxy_input.get('apifyProxyCountry', None) |
1303 |
| - groups = groups or actor_proxy_input.get('apifyProxyGroups', None) |
| 1297 | + country_code = country_code or actor_proxy_input.get('apifyProxyCountry') |
| 1298 | + groups = groups or actor_proxy_input.get('apifyProxyGroups') |
1304 | 1299 | else:
|
1305 | 1300 | proxy_urls = actor_proxy_input.get('proxyUrls', [])
|
1306 | 1301 | if not proxy_urls:
|
|
0 commit comments