Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@marcosh
Copy link
Contributor

@marcosh marcosh commented Oct 1, 2020

currently all events are loaded to check if there are concurrency conflicts.

It should be enough to load events from the initial playhead of the uncommitted events.

This could save some computations in case there are a bit of events before the conflicting playhead

@marcosh marcosh force-pushed the do-not-load-all-event-to-check-conflicts branch from 28149aa to bc5b13e Compare October 1, 2020 09:21
Copy link
Contributor

@AlessandroMinoccheri AlessandroMinoccheri left a comment

Choose a reason for hiding this comment

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

Is it possible to add a test for this behavior?

@marcosh
Copy link
Contributor Author

marcosh commented Oct 1, 2020

@AlessandroMinoccheri what would you like to test exactly, since the functionality is exactly the same as before and already tested in https://github.com/broadway/broadway/blob/master/test/Broadway/EventStore/ConflictResolvingEventStoreTest.php?

@AlessandroMinoccheri
Copy link
Contributor

I would like to know if it's possible to explicit well this behavior. I was mostly wondering if it was possible or not @marcosh

@marcosh
Copy link
Contributor Author

marcosh commented Oct 1, 2020

I would like to know if it's possible to explicit well this behavior. I was mostly wondering if it was possible or not @marcosh

@AlessandroMinoccheri the behaviour should not be changing, that's why I think already present tests should be enough. This is basically just a refactoring

@stale
Copy link

stale bot commented Nov 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 13, 2020
@marcosh
Copy link
Contributor Author

marcosh commented Nov 13, 2020

hey, anyone there? is broadway officialy a dead project?

@stale stale bot removed the stale label Nov 13, 2020
@stale
Copy link

stale bot commented Dec 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 13, 2020
@AlessandroMinoccheri
Copy link
Contributor

What do you think @othillo of this PR? For me it's ok.

@stale stale bot removed the stale label Dec 13, 2020
$events = iterator_to_array($uncommittedEvents);
/** @var DomainMessage $firstEvent */
$firstEvent = current($events);
$playhead = $firstEvent->getPlayhead();
Copy link
Member

Choose a reason for hiding this comment

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

This breaks when there are no uncommitted events.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if $uncommittedEvents is empty, I'd find it odd to receive a DeplicatePlayheadException.

Anyway, I added a check to skip every work if the DomainEventStream is empty

Copy link
Member

Choose a reason for hiding this comment

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

I don't mean to throw a DuplicatePlayheadException, I'm just saying that if $uncommittedEvents is empty PHP will error because the $firstEvent->getPlayhead() method does not exist.

Maybe we should add a test for appending zero uncommitted events to be sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I meant that this private method is called only in case of a DuplicatePlayheadException. And in that case I would find it odd to receive an empty $uncommittedEvents.

Anyway, I added the test to ensure everything works as expected.

Moreover, I added a $id = (string)$id to throw a Throwable even in case $uncommittedEvents is empty, to avoid creating a breaking change on the API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@othillo is there anything I could do on this to get this merged?

@marcosh marcosh force-pushed the do-not-load-all-event-to-check-conflicts branch from e2fa74d to f526328 Compare January 12, 2021 08:49
@stale
Copy link

stale bot commented Feb 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 12, 2021
@stale stale bot closed this Feb 19, 2021
@othillo othillo requested a review from wjzijderveld July 6, 2021 06:58
@wjzijderveld wjzijderveld reopened this Jul 6, 2021
@stale stale bot removed the stale label Jul 6, 2021
Copy link
Member

@wjzijderveld wjzijderveld left a comment

Choose a reason for hiding this comment

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

I'll fix the coding-standards issue in master

@wjzijderveld wjzijderveld merged commit c4b2cda into broadway:master Jul 6, 2021
@wjzijderveld
Copy link
Member

Thanks @marcosh !

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.

4 participants