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..

Hello there, we're running `oms:check-condition` every minute, but we have some Conditions, that we

U018XELUZS9
U018XELUZS9 Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

Hello there, we're running oms:check-condition every minute, but we have some Conditions, that we don't want to check every minute, like if an invoice was paid, since this can take a few days and fills the database with a lot of log messages. Is it somehow possible to check certain conditions only say every hour or once a day?

Comments

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    Give your oms command checking for invoice payment a higher timeout, e. g. 12 hours.
    oms:check-condition will still run once a minute, but it shouldn't write something to the database. Afaik, it won't write anything to spy_oms_transition_log until there really is a transition.

  • U018XELUZS9
    U018XELUZS9 Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    One part of our OMS looks like this:

  • U018XELUZS9
    U018XELUZS9 Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    And it's logging every minute to the database, source & target are the same

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    If you're sure that you don't need these transition logs, you're free to override the logging to skip those logs, that aren't leading to a state change.

  • U018XELUZS9
    U018XELUZS9 Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    I just wondered if there is already a clean solution for this in place. Like adding a tag to a condition and to the oms:check-condition command.

    <transition happy="true" condition="Heidelpay/IsOrderPaid" condition-tag="daily">
        <source>finalizing finished</source>
        <target>paid</target>
    </transition>
    

    And a scheduler job that runs once a day and executes: vendor/bin/console oms:check-condition --tag=daily

  • U018XELUZS9
    U018XELUZS9 Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    We already plan to keep the database clean, but would be nice to make the process efficient overall.

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    How about creating a separate jenkins job that will archive oms transition logs of completed orders and delete them from spy_oms_transition_log? That way your db table size would stop growing indefinitely and you probably needn't care too much of oms checks every minute.

  • U018XELUZS9
    U018XELUZS9 Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    We plan to do this, I just wondered if there is a more efficient way to run these checks.

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    I'd be curious, too.

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    If you're going to archive and delete oms transition logs, be aware, that you will lose the ability to view order items' state change history in Zed's order details.

  • U018XELUZS9
    U018XELUZS9 Posts: 167 πŸ§‘πŸ»β€πŸš€ - Cadet

    Sure, we'll only delete duplicate entries that have the same source & target, so this shouldn't be a problem I think.

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    In that case I wouldn't archive them afterwards. Instead, I'd change the logging behavior so that those duplicate entries won't be created right away. That way, it also wouldn't increase your auto_increment ids more than needed.