Gateway Script Behavior

Hey y'all,

I know that Gateway Timers and Tag Change scripts don't overlap in execution. Is this the same behavior for Message, (god forbid these actually ever happen) Scheduled, and Update Scripts? Like if I call the same message script using system.util.sendMessage(), from a couple different scripts, is the message going to race against itself, or will it just handle a like a queue and handle the first message first?

Also, is this behavior documented in the User Manual? I looked around for a good bit and couldn't find anything, but I also could have just completely missed it. If not, I may send an email to the documentation group for that, as it is important behavior when dealing with tags changing from multiple sources.

Ok, I figured out a test I could do for the messaging system, and it definitely seems that messages sent to the same handler are queued.

Gateway Message Called 'A' in 'project'
from time import sleep
sleep(6)
system.util.getLogger('Debug').warnf('completed execution at %s', system.date.now())
Script Console
system.util.sendMessage('project', 'A')
system.util.sendMessage('project', 'A')
system.util.sendMessage('project', 'A')
Result

image

I didn't initially realize how trivial it would be to test the message system. It's early

This was with Shared Threading

Please do. It is well-established behavior that each distinct event definition in the project event scripts gets one dedicated thread, except timers, where you can opt to share.

Hey Xander,

There's documentation regarding threading. Based on the wording for Shared, to me it would be possible to execute two of the same messages in parallel since it is a shared thread pool. But your test proves other wise :thinking:

Messages have shared or dedicated threading, as well. I only tested with Shared threading (which I'll add in an edit), which gave this behavior. I might try Dedicated threading if I get a lull at work and see if that gives different behavior.