What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

I am wondering, what was going on in the developers head when he wrote this:

UNBSW8S8K
UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

I am wondering, what was going on in the developers head when he wrote this:
https://github.com/spryker/product-page-search/blob/master/src/Spryker/Zed/ProductPageSearch/Business/Model/ProductPageSearchWriter.php#L66-L85

I guess it sounds something like this - hmm, there is a possibility of race conditions when same event message gets in two or more parallel processing batches. Ok, let's handle this case, but you know what - let's log it as a critical error, because we already handled it.

Brilliant!

Comments

  • Ehsan Zanjani
    Ehsan Zanjani Head of Solution Architecture @ Spryker Posts: 113 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    Spryker comes with an auto-healing mechanism on race condition situations, (event-retry queues), the try/catch part must be cleaned up as there is no need to save an entity again in the failing scenario

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    Still, even after X retries, this can happen, especially on high load systems. Just saying...

  • Ehsan Zanjani
    Ehsan Zanjani Head of Solution Architecture @ Spryker Posts: 113 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    Having a race conditions means that we are processing duplicate events in two or more different threads, which is the root cause of this race condition so we need to avoid trigger duplicate events as the last event is valid

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    Yes, you are right. But the main consequences are that 1-by-1 processing flow is triggered after this happens, thus performance suffers dramatically.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    As well, you can't avoid duplicate event triggering, if entry-points for these event triggers are different flows.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    Especially related to page search events, as there are many entry-points for that stuff.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    Potential improvement would be not listen on product abstract event for page search, but introduce its own.

  • Ehsan Zanjani
    Ehsan Zanjani Head of Solution Architecture @ Spryker Posts: 113 πŸ§‘πŸ»β€πŸš€ - Cadet

    This is flexible during data-import, projects can triggers their own events and subscribe it with core listeners

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet

    At this point, we don't need spryker then. Thanks for your input.

  • Ehsan Zanjani
    Ehsan Zanjani Head of Solution Architecture @ Spryker Posts: 113 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    Sure, your welcome! you can always decide when and where use project or core events. Spryker gives this flexibility to developers to decide on their implementation.

  • UNBSW8S8K
    UNBSW8S8K Posts: 128 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    This is flexible during data-import

    FYI - this is not only during data import. Even if clicking through zed UI multiple users at once, same behavior can happen.

  • Ehsan Zanjani
    Ehsan Zanjani Head of Solution Architecture @ Spryker Posts: 113 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    At this point, we don’t need spryker then.

    Spryker allows project to change the configuration to satisfy their needs, e.g ModuleConfig, DependencyProvider, Subscribers, etc.

    FYI - this is not only during data import. Even if clicking through zed UI multiple users at once, same behavior can happen.Β (edited)

    In our new improvements for P&S which have been released, now projects can also adjust the different core events with different listeners in new plugins and replace them in the configuration in projects:
    https://github.com/spryker-shop/suite/blob/master/src/Pyz/Zed/Publisher/PublisherDependencyProvider.php

    We will release the documentations for this update as soon as they are ready πŸ™‚

    Let men know if you still have questions