writeToTags, writeValues difference

Hello! I made a schedule script by means of gateway timer script in dedicated thread. It works like this:
first condition checks are performed, if condition is satisfied for some indication tags, other tags (control tags) values has to be changed. Because there is many of control tags (few hundreds), they are not changed individualy. All pathes and needed values of tags, that has to be changed, are appended to some lists, which is fed to writeToTags as parameters at the end of the script.
Sometimes it doesn’t work like intended. Though checks are performed in time, and lists formed properly, actual writes are made with significant delay (up to few hours). This issue makes my schedule highly unstable.
What can cause such malfunction, and is there other way of realisation of schedule (I’m still using old ignition version without scheduled transaction groups)? I founded out that there is some writeValues function, which writes values directly to opc items, would it work instantly? Would it be performed once, regardless of result? Would it generate errors if write unsuccessful? Would it hang gui thread, if script is called in dedicated thread?

The writeToTags function on a gateway timer script shouldn’t take that long. How many are you writing to? You are using a gateway timer script right? Is your timer script set to Fixed Delay or Fixed Rate? You don’t want to use Fixed Rate since the scripts can start stacking up.

All of those scripts run in a separate thread than the GUI thread so it won’t hang the UI. The system.opc.writeValues function will write directly to the tags but I would expect the same behavior. You can always try it out and see. We should look at the tag diagnostics in the gateway to see how long these writes are taking.