[Solved] `exports.activate` appears to loop endlessly

I’m experimenting with my first extension, so please bear with me. :slight_smile:

I’m thinking of running an update routine in exports.activate that will automatically update the binaries whenever the extension is activated. I have got the code to run, but it appears to run in an endless loop while testing. Is this just a side-effect of how the extension live-reloads during testing, or will it always behave this way?

In exports.activate I am running a process that updates the binary. The update of the binary appears to cause the extension to reload. Am I correct that this is because the extension is in development mode, and reloads automatically whenever there is a file change within the extension, to help with developing the extension? Or is this common behavior, even after the extension has been published?

Thanks!

Update: after some initial testing it appears to only be a development side-effect, and not something that happens when installing extensions normally.

Yes. This is because if a file changes in an extension which has been loaded during development, Nova automatically restarts the extension. There’s an outstanding feature request to allow an author to turn this off for cases like this!

3 Likes

+1 on the ability to disable restarts, please!

I had to “debug in production” for a faulty binary update because the update is turned off in Dev Mode for this reason. It wasn’t the smoothest launch day for a new extension… :sweat_smile: