Skip to content

Conversation

@unixslayer
Copy link
Member

@unixslayer unixslayer commented Apr 16, 2025

projections should keep running when:

  • runs with keepRunning: true due it awaits for new events
  • it did not reached end of the stream, e.g. in case of resetting

projection status should indicate actual status of projection therefore, idle should be set if projection wasn't supposed to keep running or end of stream was reached

@unixslayer
Copy link
Member Author

@basz @prolic please, review.

@prolic
Copy link
Member

prolic commented Apr 17, 2025 via email

@unixslayer unixslayer force-pushed the keep-projection-running-as-long-events-are-loading branch 3 times, most recently from 0cb821a to bd3a48b Compare April 17, 2025 09:04
@unixslayer
Copy link
Member Author

unixslayer commented Apr 17, 2025

@prolic done

if merged, please also to release it.

@unixslayer unixslayer force-pushed the keep-projection-running-as-long-events-are-loading branch 2 times, most recently from 6e10d05 to a44ce44 Compare April 17, 2025 12:18
@basz
Copy link
Member

basz commented Apr 18, 2025

I can have a look later today. But am wondering if this should be considered a breaking change release.

Even though it's a small bug fix it changes a side effect that consuming applications might rely on.

Any advise on this?

@unixslayer
Copy link
Member Author

I can have a look later today. But am wondering if this should be considered a breaking change release.

Even though it's a small bug fix it changes a side effect that consuming applications might rely on.

Any advise on this?

@basz this is somehow a follow-up to #246.

For projections running with keepRunning: true nothing changes. The problem comes with projections with keepRunning: false. Especially if you want to reset them. Before that bug was solved, projection status remains running with lock released if load_count is low so we know it has to be triggered once more so it will go to the end of the stream. But now, projection status is set to idle after handling loaded events therefore, before the end of the stream so we don't know if it actually finished.

I don't consider this as a BC but more like a critical issue fix in the context of projection management.

@unixslayer
Copy link
Member Author

We are running all our projections with keepRunning: false so we don't have long running processes and trigger them only when they need to be triggered.

@basz
Copy link
Member

basz commented Apr 18, 2025

Any tests included inside files named *TestCase aren't executed it seems.

(see with vendor/bin/phpunit --testdox)

Don't know if this slipped through or is an deliberate choice, but a lot of tests never ran... (including yours)

@basz
Copy link
Member

basz commented Apr 18, 2025

see ./vendor/bin/phpunit --list-tests -c phpunit.postgres.xml

@unixslayer
Copy link
Member Author

I didn't even notice that. Normally I run my own tests locally and let the test suite run in CI.

I think this is happening due to changes in PHPUnit itself. We've had that issue in the project some time ago when switching to a newer version.

I can check that later.

@unixslayer unixslayer force-pushed the keep-projection-running-as-long-events-are-loading branch from a44ce44 to 4b0921b Compare April 21, 2025 19:57
projections should keep running when:
- runs with `keepRunning: true` due it awaits for new events
- it did not reached end of the stream, e.g. in case of resetting

projection status should indicate actual status of projection therefore, `idle` should be set if projection wasn't supposed to keep running or end of stream was reached
@unixslayer unixslayer force-pushed the keep-projection-running-as-long-events-are-loading branch from 4b0921b to 4cc9e4f Compare April 21, 2025 20:00
@unixslayer unixslayer changed the title keep running projections keep projections running as long events are loading Apr 21, 2025
@unixslayer
Copy link
Member Author

@basz this one is also ready for review and release ;)

function (array $state, Message $event) use ($projectionManager, $gapDetection, $parallelConnection): array {
if ($state['iteration'] === 1) {
Assertion::true($gapDetection->isRetrying());
$parallelConnection->commit();
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to change a little bit logic in this test due now each projection will try to finish by itself

@unixslayer
Copy link
Member Author

@basz sorry for pushing but is there any chance to have this reviewed by today?

@basz
Copy link
Member

basz commented Apr 22, 2025

nice work. one thing i noticed without the changes to the PdoEventStoreReadModelProjector.php the tests never run to completion. I would expect a failing test in such a case. going to merge anyway, feel free to have a look at that.

@basz basz merged commit 78d2f21 into prooph:master Apr 22, 2025
27 checks passed
unixslayer added a commit to unixslayer/ecotone-dev that referenced this pull request Apr 22, 2025
dgafka pushed a commit to ecotoneframework/ecotone-dev that referenced this pull request Apr 23, 2025
increase minimum version of PDOEventStore due prooph/pdo-event-store#257
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants