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, I need to label lot of products. I used Spryker's label feature and added `ProductLabelRelati

USZB5JN4W
USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

Hello, I need to label lot of products. I used Spryker's label feature and added ProductLabelRelationUpdaterPluginInterface , but it's launched every minute and this can be a bit problematic with big amount of products. Does Spryker have other possibility to add/remove label on product save?

Comments

  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hi, how much products do u have? and how much do u think have to be labeled in average?

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    few thousands (with inactive products), but later it can increase

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    I'm thinking about using ProductAbstractPluginUpdateInterface , but looks like ProductLabelRelationUpdaterPluginInterface is "spryker way"

  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ok, it is not a problem with standard code/beahviour from spryker..
    we have ca. 3 Mio and we have just a couple of optimization (with spryker together) and everything is works fine..

    The job take max. 1 min to terminate our job calculation..

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    hmm could you tell, which optimizations have you done? πŸ™‚

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    i mean for now it works ok, but i'm little worried, because ProductLabelRelationUpdaterPluginInterface is launched by cron (jenkins) every minute

  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    of course... we have a lot of product discontinued and it was a bottleneck performance problem and also memory allocation problem..

    We have in \Pyz\Zed\ProductDiscontinuedProductLabelConnector\Persistence\ProductDiscontinuedProductLabelConnectorRepository::getProductAbstractIdsToBeLabeled the function in pyz level overrided so: (there are no other possibilities than plain query due limitation of propel)

    /**
         * @module Product
         * @module ProductDiscontinued
         *
         * @return int[]
         */
        public function getProductAbstractIdsToBeLabeled(): array
        {
            $productAbstractWithNotDiscontinuedProductConcreteSubQuery = '
                SELECT ' . SpyProductTableMap::COL_FK_PRODUCT_ABSTRACT . '
                FROM ' . SpyProductTableMap::TABLE_NAME . '
                LEFT JOIN ' . SpyProductDiscontinuedTableMap::TABLE_NAME . '
                    ON (' . SpyProductTableMap::COL_ID_PRODUCT . ' = ' . SpyProductDiscontinuedTableMap::COL_FK_PRODUCT . ')
                WHERE ' . SpyProductDiscontinuedTableMap::COL_ID_PRODUCT_DISCONTINUED . ' IS NULL';
    
            return $this->getFactory()
                ->getProductPropelQuery()
                ->where(SpyProductTableMap::COL_FK_PRODUCT_ABSTRACT . ' NOT IN (' . $productAbstractWithNotDiscontinuedProductConcreteSubQuery . ')')
                ->distinct()
                ->select([SpyProductTableMap::COL_FK_PRODUCT_ABSTRACT])
                ->find()
                ->toArray();
        }
    

    This is just a patch that we applied on pyz level and it works very good.

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    will check this. Thanks πŸ™‚