From 3c5d3fc5698633e371214062895cbb956e9e3081 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Thu, 14 Aug 2025 18:57:07 +0000 Subject: [PATCH 1/2] retry license errors on "info user". Fixes #1817 --- src/gam/__init__.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 344eba69..c001083c 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -44894,21 +44894,39 @@ def waitForMailbox(entityList): Ind.Decrement() def getUserLicenses(lic, user, skus): - def _callbackGetLicense(_, response, exception): + def _callbackGetLicense(request_id, response, exception): if exception is None: if response and 'skuId' in response: licenses.append(response['skuId']) + del(sku_calls[request_id]) + else: + if exception.reason == not_found: + del(sku_calls[request_id]) + not_found = 'User does not have a license for specified sku and product' licenses = [] svcargs = dict([('userId', user['primaryEmail']), ('productId', None), ('skuId', None), ('fields', 'skuId')]+GM.Globals[GM.EXTRA_ARGS_LIST]) method = getattr(lic.licenseAssignments(), 'get') dbatch = lic.new_batch_http_request(callback=_callbackGetLicense) + sku_calls = {} for sku in skus: svcparms = svcargs.copy() svcparms['productId'] = sku[0] - svcparms['skuId'] = sku[1] - dbatch.add(method(**svcparms)) - dbatch.execute() + sku_id = sku[1] + svcparms['skuId'] = sku_id + sku_calls[sku_id] = method(**svcparms) + try_count = 0 + while sku_calls: + try_count += 1 + dbatch = lic.new_batch_http_request(callback=_callbackGetLicense) + for sku_id, sku_call in sku_calls.items(): + dbatch.add(sku_call, request_id=sku_id) + dbatch.execute() + if sku_calls: + if try_count >= 5: + # give up and return what we have + return licenses + time.sleep(5) return licenses USER_NAME_PROPERTY_PRINT_ORDER = [ From 4d3edf7203c987397b5476bfdf365c8f2bff0d01 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Thu, 14 Aug 2025 16:30:11 -0400 Subject: [PATCH 2/2] actions: rebuild for Python 3.13.7 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e06eeae6..c991a1cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,7 +126,7 @@ jobs: with: path: | cache.tar.xz - key: gam-${{ matrix.jid }}-20250805 + key: gam-${{ matrix.jid }}-20250814 - name: Untar Cache archive if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit == 'true'