mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-01 21:47:16 +00:00
I was hoping to reduce the query count but it stayed the same. In fact, I'm expecting the query count to be higher with this version. The DfcCatalogImporter queries all variants and links at once while the OC job is not pre-loading the variants at the moment. We can optimise the job though. If we kept the old version and there were multiple catalogs per variant then we would call the importer with the reset multiple times. The job is iterating through each link only once though. So depending on the ratio of catalogs to variants, I'm not sure which version would be more efficient. No version is properly dealing with the edge-case of multiple catalogs per variant anyway. Imagine there are two catalogs with different stock levels. Which one do we choose? Or do we add up? And if the variant disappears from one catalog we still want to sell it through the other. But depending on the order of processing, we may reset the variant if it's missing in the last catalog. But let's worry about that when it actually happens. Maybe it will be better to restrict variants to one catalog.