System.alarm.acknowledge() timing and augmented alarms

Hi all,

I’ve wrapped some of the alarm functionality to add some extra data that we need and to store it in an extra table in an easier to use format. The way it works is when an alarm comes through the pipeline, an expression block calls a script with the alarm’s UUID, then the script looks up all that alarm’s data in the DB and then creates an augmented alarm instance for it.

It’s working fine until someone wants to acknowledge the alarm. My acknowledge button is essentially:


The problem I’m seeing is that the acknowledge() call returns before the acknowledge events are written into the database, so that when I doWork() it doesn’t see that the alarm is acknowledged and misses out on getting that important data.

If I wait a little while (a few seconds or so) before doing the doWork call, it all works. Is there an elegant solution that will ensure that the DB work that system.alarm.acknowledge does will be complete before I doWork? I had wrongly assumed that the returning of the call would indicate that the DB had been updated, but I guess the acknowledges get buffered somewhere.