enrol_campusonline\sync class should keep track of the age of its REST token und only renew then necessary
During testing of the enrol_campusonline\task\org_sync_task today our colleage notified us of high load on our campusonline d-system, which we also noticed on the moodle side as 503 and 404 errors started popping up during the sync process leading to issues in the synced data.
He also mentioned that the load was partially due to an excessive amount of calls to the /public/sec/auth/realms/CAMPUSonline_SP/protocol/openid-connect/token endpoint.
Currently the sync\update_token() function is called during each call of the sync\rest_call() function and requests a new token - regardless of the age of the token.
The class should keep track of the age of the token and only request a new one if the old token is close to expiration. As far as I am told the maximum age of the token on the Campus Online side is not configurable and can be used as a global constant or as an admin option of the plugin.