fix(actor): adapt PlatformEventManager to crawlee v4 EventManager API#594
Open
B4nan wants to merge 5 commits intorefactor/configuration-class-redesignfrom
Open
fix(actor): adapt PlatformEventManager to crawlee v4 EventManager API#594B4nan wants to merge 5 commits intorefactor/configuration-class-redesignfrom
B4nan wants to merge 5 commits intorefactor/configuration-class-redesignfrom
Conversation
Crawlee v4's `EventManager` constructor now requires `EventManagerOptions` (just `persistStateIntervalMillis`), and the base class no longer carries a `config` field — the previous `override readonly config` pattern is no longer valid. - Drop the `override` and store `config` as own readonly property. - Forward `persistStateIntervalMillis` to `super()`. - Add a `fromConfig()` factory mirroring `LocalEventManager.fromConfig()` so the SDK plays nicely with the new ServiceLocator-driven init path. Stacked on #583 (config redesign); rebases onto v4 once that lands.
`Configuration.useEventManager()` was removed in crawlee v4. Install the platform event manager via the global service locator instead, and reset between tests so each case can register a fresh manager without hitting `ServiceConflictError`.
Crawlee v4's `Configuration` is eager — `actorEventsWsUrl` is read once at construction, so a global config that pre-existed the `beforeEach` would never see the websocket URL we set, and `events.init()` would silently never connect. Move the env-var setup above `Configuration.getGlobalConfig()` and reset the SDK's static singleton so each test rebuilds a fresh config.
4f65fb8 to
f5d0e03
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Crawlee v4's
EventManagerconstructor changed:EventManagerOptions(justpersistStateIntervalMillis).configfield — the previousoverride readonly configpattern is invalid.This PR adapts
PlatformEventManager:override; storesconfigas own readonly property.persistStateIntervalMillistosuper().fromConfig()factory mirroringLocalEventManager.fromConfig()so the SDK plays nicely with the new ServiceLocator init path.Stacking
Depends on #583 (config redesign). Rebases cleanly onto v4 once #583 lands.