Requesting Project Scan

Im working on a third party tool that allows editing of files outside of the designer, after editing and saving I need to trigger a project scan (data/api/v1/scan/projects) so that the latest changes are picked up but this raises a few questions:

  • Do I have to acquire a project scan lock(data/api/v1/scan-lock/projects) before requesting a project scan?
  • Is project scanning asynchronous? The reason I ask this is because we have a module that will update the designer project after receiving a notification from the gateway but I don’t want to create a race condition where the designer project updates before the gateway is done with its project scan.

It's asynchronous.

The scan lock is optional.

1 Like

You can GET the same endpoint to check whether a scan is already running.

Note that no matter what you do, there's no (supported) way to force any open designers to pull the updated project from the gateway, so this may never get the user experience you really want.

1 Like

Is there a supported way to inform Designer sessions that a resource has been changed, similar to what happens when another user’s Designer session publishes a Save? If there is no need to actually force the pull that is

I have GitHub Actions set up that (on update of remote repo under certain conditions) update the local repo on a Docker Host, uses mapping YAML docs to push the called for files into the appropriate directories of the gateways running in Docker containers, and ping the scan APIs of each gateway to tell Ignition that there are new resources. If I click the refresh icon in the Designer, everything is there just fine. But you would have had to know that things had changed, as it didn’t throw that utility message in the bottom toolbar

If this is possible, is it only via a custom module that makes use of some designer class? Or is it possible just with native 8.3 functionality without having to have a Designer session run?

Preemptive disclaimer: This is well in the "implementation detail" weeds - we don't guarantee something like this will continue working indefinitely, but for all of 8.3 and with some minor adjustments 8.1, you could take advantage of the same mechanism we currently use for designer conflict messages.
These are "push notifications" delivered to each active session when one particular designer makes a change. The message class is com.inductiveautomation.ignition.designer.concurrency.DesignerProjectUpdate, and the notification message is sent to all active designers running the given project:

        for (ClientReqSession s : sessions) {
          s.addNotification(
              PLATFORM_MODULE_ID,
              DesignerConcurrencyMessage.PROJECT_UPDATE,
              update,
              PushNotificationSerializer.ofString(DesignerConcurrencyMessage.GSON::toJson));
        }

If you pushed those updates from another module, the designer wouldn't know the difference and you'd get the exact same behavior for end users.

EDIT:
For what it's worth, I just created an internal ticket IGN-15468. We should just refactor the way this "a resource update was detected" logic happens so that it detects any kind of change, not just changes from a running designer instance.

2 Likes