Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commmand oro:cron:integration:cleanup should exclude each connector per channel #1086

Open
GautierDig opened this issue Aug 18, 2022 · 0 comments

Comments

@GautierDig
Copy link

GautierDig commented Aug 18, 2022

Summary
When working with integration, the oro:cron:integration:cleanup delete every old status just by retrieving the latest connector base on the date column of the table oro_integration_channel_status.

The issue is that with multiple channel using the same connector, it will only keep the latest status of the connector where I would expect it to keep the last status of each connector per channel (a connector for a specific channel could fail where the same connector for another could work perfectly)

Here is the fix I propose:

diff --git a/vendor/oro/platform/src/Oro/Bundle/IntegrationBundle/Command/CleanupCommand.php b/vendor/oro/platform/src/Oro/Bundle/IntegrationBundle/Command/CleanupCommand.php
--- a/vendor/oro/platform/src/Oro/Bundle/IntegrationBundle/Command/CleanupCommand.php	
+++ b/vendor/oro/platform/src/Oro/Bundle/IntegrationBundle/Command/CleanupCommand.php	(date 1660749776329)
@@ -215,15 +215,16 @@
     oro_integration_channel_status AS a
         INNER JOIN
     (
-        SELECT connector, MAX(date) AS minDate
+        SELECT channel_id, connector, MAX(date) AS minDate
         FROM oro_integration_channel_status AS b
         WHERE b.code = '1'
-        GROUP BY connector
+        GROUP BY channel_id, connector
     ) b ON a.connector = b.connector AND
-           a.date = b.minDate
+           a.date = b.minDate AND
+           a.channel_id = b.channel_id
 WHERE a.code = '1'
 GROUP BY
-    a.connector
+    a.channel_id, a.connector
 SQL;
         $selectQuery = sprintf(
             $selectQuery,

Details about your environment

  • OroPlatform version: 4.2.9
  • PHP version: 7.4.29
  • Database PostgreSql 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant