Skip to content

Conversation

@TC-MO
Copy link
Contributor

@TC-MO TC-MO commented Oct 8, 2024

Restructure content with additional headings & subheadings
Simplified language
Adjusted heading levels

TC-MO added 2 commits October 7, 2024 03:11
Restructure content with additional headings & subheadings
Simplified language
Adjusted heading levels
@fnesveda fnesveda added the t-docs Issues owned by technical writing team. label Oct 9, 2024
@TC-MO TC-MO marked this pull request as ready for review October 10, 2024 09:03
@TC-MO TC-MO requested a review from vdusek October 10, 2024 09:03
Comment on lines 50 to 62
## Implementing state persistence

The [Apify SDKs](/sdk) handle state persistence automatically.

In JavaScript, this is done using the `migrating` and `persistState` events in the [PlatformEventManager](/sdk/js/api/apify/class/PlatformEventManager).

- The `persistState` event prompts SDK components to save their state at regular intervals
- The `migrating` event is triggered just before a migration occurs.

In Python, state persistence is handled using the `Actor.on()` method and the migrating event, similar to JavaScript. The Apify SDK for Python provides mechanisms to save and retrieve state data.

- The `migrating` event is triggered just before a migration occurs, allowing you to save your state.
- To retrieve previously saved state, you can use the `Actor.get_value()` method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you could link the PlatformEventManager API reference of both JS and Python implementations.

You can also mention, that the event manager is encapsulated with Actor class, and when you want to interact with that you should use Actor.on and Actor.off. And it will use the underlying event manager instance in Actor.

Or you do not have to mention EventManagers at all and go with just the shortcuts.

Copy link
Contributor

@vdusek vdusek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe you could just slightly rewrite the new "Implementing state persistence" section. Mostly things should work the same regardless the JS/Python implementation. So I would get rid of of words like "In Python/JavaScript...". Otherwise it is good, thanks 🙂 .

@TC-MO
Copy link
Contributor Author

TC-MO commented Oct 10, 2024

I've removed mentions of PlatformEventManager and left just links to to get values methods in both JS & Python , that seems more elegant and relevant

@TC-MO TC-MO requested a review from fnesveda October 10, 2024 11:09
Copy link
Member

@fnesveda fnesveda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a few suggestions and corrections

Co-authored-by: František Nesveda <[email protected]>
@TC-MO TC-MO requested a review from fnesveda October 10, 2024 11:31
@TC-MO TC-MO merged commit 8ba2b97 into master Oct 10, 2024
7 checks passed
@TC-MO TC-MO deleted the state-persistence-rewrite branch October 10, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-docs Issues owned by technical writing team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants