-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SUPPORT-27819 fix concurrent lock acquiring when concurrently fetchin…
…g token (#777) * SUPPORT-27819 fix concurrent lock acquiring when concurrently fetching token * chore(tokenCache): re-introduce token cache - re-introduce store as a default value for tokenCache to fix tokenCache.get error. * chore(auth-request-executor): skip test - skip test as implementation was replaced * chore(SUPPORT-27819): remove unnecessary comments - remove unnecessary and unused code blocks * chore(release-changeset): add release changeset - add release changeset for @commercetools/ts-client --------- Co-authored-by: Chukwuemeka Ajima <[email protected]> Co-authored-by: Ajima Chukwuemeka <[email protected]>
- Loading branch information
1 parent
e76b5cf
commit 38c7035
Showing
10 changed files
with
84 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@commercetools/ts-client': patch | ||
--- | ||
|
||
Bug fixes for @commercetools/ts-client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/platform-sdk/test/integration-tests/sdk-v3/concurrent-processing.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { createCategory } from '../category/category-fixture' | ||
import { | ||
authMiddlewareOptionsV3, | ||
createTokenCache, | ||
httpMiddlewareOptionsV3, | ||
projectKey, | ||
} from '../test-utils' | ||
import { ClientBuilder as ClientBuilderV3 } from '@commercetools/ts-client/src' | ||
import { createApiBuilderFromCtpClient } from '../../../src' | ||
|
||
describe('Concurrent processing in sdk v3', () => { | ||
it(`should fetch 2 categories concurrently`, async () => { | ||
const category1 = await createCategory() | ||
const category2 = await createCategory() | ||
|
||
const tokenCache = createTokenCache() | ||
|
||
authMiddlewareOptionsV3.tokenCache = tokenCache | ||
|
||
const client = new ClientBuilderV3() | ||
.withClientCredentialsFlow(authMiddlewareOptionsV3) | ||
.withHttpMiddleware(httpMiddlewareOptionsV3) | ||
.withConcurrentModificationMiddleware() | ||
.build() | ||
|
||
const apiRoot = createApiBuilderFromCtpClient(client).withProjectKey({ | ||
projectKey, | ||
}) | ||
|
||
const key = category1.body.key | ||
const key2 = category2.body.key | ||
|
||
const [response1, response2] = await Promise.all([ | ||
apiRoot.categories().withKey({ key }).get().execute(), | ||
apiRoot.categories().withKey({ key: key2 }).get().execute(), | ||
]) | ||
|
||
expect(response1.statusCode).toBe(200) | ||
expect(response2.statusCode).toBe(200) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters