License detected only after disable/enable of plugin in UPM

Dear Community,

I have successfully written a plugin with rest endpoints. The plugin has license support. Everything works pretty fine. The plugin can detect whether a license is present or not. There is only one issue:

When I add a license (while unlicensed), the plugin does only detect it, when I disable/enable the plugin before.
Also vice versa: When the 60s timebomb has expired, the plugin still works - only the disable/enable invalids the license.

Any hints are welcome.

Many thanks in advance

Dear community,

many thanks for that many responses and hints :wink:

I would say: “Lessons learned”. My assumption before debugging my code was, that when calling a rest endpoint, all its objects die after execution. I was wrong. :grimacing:

I had a license managing class created that was called by the other endpoints. In its constructor I did the license validation, assuming per call this object is created from scrach. :frowning:

The fix was to move the validation into a method.

So long