Release Groupshare TM CAL after RunAutomaticTask completed

Dear Community

We are using the c# Project Automation API to generate Analysis Reports. Two weeks ago we moved our TM's to Groupshare and since then we are consuming one CAL per Analysis Task.

As multiple Tasks have to run in parallel, our licenses are consumed fast. Therefore we limited the parallel API threads to a specific number of licenses that we want it to consume.

It seems like, unfortunately, the licenses are not returned immediatly after the RunAutomatictask is completed, as we are still running out of licenses when new threads start, although the previous ones have terminated.

This is an extraction of the code:

project is of type FileBasedProject;

# Add credentials:

Uri tmAddress = new Uri($"sdltm.{Config.getTmServerAddress()}{Config.getTmServerOrganizationPath()}");
project.Credentials.AddCredential(tmAddress, false, Config.getTmServerUserName(), Config.getTmServerPassword());

# Run automatic task:

AutomaticTask analyzeTask = project.RunAutomaticTask(
                targetFiles.GetIds(),
                AutomaticTaskTemplateIds.AnalyzeFiles,
                  (sender, TaskStatus) => { (...); },
                  (sender, ScanMess) => { (...); }

                );

We did not find any function in the API to free the CALS by command after the RunAutomaticTask has completed.

The "project" object is not needed anymore afterwards and could be destroyed or unloaded, but we also did not find any information on doing this and freeing the licenses.

Does anyone know how to free the licences correctly?

If not, is there any explaination on how the mechanic of the freeing works, so we could arrange our top system?

Best regards,

Kai