Trigger causing infinite loop on "Metadata Field Updated" event


(Jamie Smith) #1

(Matrix v4.14.1)

 

Hello. I have a Trigger that listens for a specific metadata field being updated. When the Trigger fires, a Trigger Action updates the value of a different metadata field. However, the Trigger appears to be firing regardless of which metadata field is updated. The Action then in turn causes the Trigger to re-fire, resulting in a loop that only stops when Matrix runs out of memory.

 

Looking at the system log, there are alternating entries for fields 183343 and 181669 being updated, although no message to say that the Trigger has successfully fired.

 

Here's a screenshot of the Trigger setup:

 

 

Note that the Action shown in the screenshot is the only Action in this Trigger. Also, the Trigger here is limited to a specific asset for testing purposes, but will ultimately be applied to a folder of assets. The third Condition is where I was planning to increment a value so as to stop the Trigger re-firing after a certain number of times. However, I think this whole thing may be caused by a bug.

 

Does anyone know whether this is indeed a bug, or if I'm missing something and should be suitably embarrassed?

 

Any help greatly appreciated!

 

Jamie


(Jamie Smith) #2

Can anyone at Squiz confirm whether this is a bug?


(Bart Banda) #3

I've seen this happen before on old versions of Matrix as well, but I can't remember if it was a bug that was fixed or not, we'll try and replicate on the current stable release.

 

In the meantime, could you maybe use the After asset metadata updated event instead? I think that's how I normally got around this problem. 


(Anthony Ponomarenko) #4

It looks like you have found a case that will need to be looked at. I have created a ticket for it here:

 

https://squizmap.squiz.net/matrix/8192

 

As it stands you will not be able to use this setup you currently have, as it will always timeout.

 

When saving a metadata field Matrix triggers the updated event for all metadata fields.

 

We will hopefully have a solution in one of our next releases.


(Jamie Smith) #5

In the meantime, could you maybe use the After asset metadata updated event instead? I think that's how I normally got around this problem. 

 

Many thanks for getting back to me, Bart. Alas, the After Asset Metadata Updated event appears to occur only on Schema regeneration, and not when only a value in a field is updated (https://manuals.matrix.squizsuite.net/triggers/chapters/trigger-events#After-Asset-Metadata-Updated). However, I would be happy to stand corrected!


(Jamie Smith) #6

It looks like you have found a case that will need to be looked at. I have created a ticket for it here:

 

https://squizmap.squiz.net/matrix/8192

 

Thanks, Anthony.


(Jamie Smith) #7

Just to highlight that this bug (#8192) doesn’t appear to have been fixed. I’m running Matrix v5.4.0.1 with a Trigger listening for an Asset Metadata Updated event. A specific field and value are specified as conditions, with an Action to update an unrelated metadata field. However, the other field being updated causes the Trigger to run again and creates a loop until the Trigger is disabled.


(Bart Banda) #8

Hi Jamie, I’m pretty sure that has been fixed further in later releases, not sure exactly in what version though.