Title: Intermittent Gateway Tag Event delays / PLC heartbeat timeout on script-heavy InTouch 2012 migration

Can you clarify if you mean Gateway Tag Change Events which are defined in the project, or Tag Value Change Events which are defined on the tag. There reason is you seem to mix you language between these two things.

e.g.

Emphasis added.

These are two very different things with very different constraints.

Later in the post you provide a script which includes a def statement, but Gateway Event Scripts do not include this.

If you are in fact using Tag Value Change Events, and you are reaching out to databases and/or performing blocking writes, I wouldn't be suprised if you are having issues.

Here are some posts with pertinent information: