Skip to content

Commit

Permalink
chore(release): pull hotfix-release/v1.39.1 into main (#2523)
Browse files Browse the repository at this point in the history
  • Loading branch information
devops-github-rudderstack authored Aug 28, 2023
1 parent f7de80e commit d00c616
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.39.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.39.0...v1.39.1) (2023-08-28)


### Bug Fixes

* faas pods creation failure due to caching ([9b88c30](https://github.com/rudderlabs/rudder-transformer/commit/9b88c309856698e479858cfe78a0c0166a312f47))

## [1.39.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.38.0...v1.39.0) (2023-08-20)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.39.0",
"version": "1.39.1",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
20 changes: 17 additions & 3 deletions src/util/openfaas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,18 @@ const isFunctionDeployed = (functionName) => {

const setFunctionInCache = (functionName) => {
const funcList = functionListCache.get(FUNC_LIST_KEY) || [];
funcList.push(functionName);
functionListCache.set(FUNC_LIST_KEY, funcList);
if (funcList.includes(functionName)) return;
const funcListSet = new Set(funcList);
funcListSet.add(functionName);
functionListCache.set(FUNC_LIST_KEY, Array.from(funcListSet));
};

const removeFunctionFromCache = (functionName) => {
const funcList = functionListCache.get(FUNC_LIST_KEY) || [];
if (!funcList.includes(functionName)) return;
const funcListSet = new Set(funcList);
funcListSet.delete(functionName);
functionListCache.set(FUNC_LIST_KEY, Array.from(funcListSet));
};

const invalidateFnCache = () => {
Expand Down Expand Up @@ -150,7 +160,10 @@ const deployFaasFunction = async (functionName, code, versionId, libraryVersionI
logger.error(`[Faas] Error while deploying ${functionName}: ${error.message}`);
// To handle concurrent create requests,
// throw retry error if deployment or service already exists so that request can be retried
if ((error.statusCode === 500 || error.statusCode === 400) && error.message.includes('already exists')) {
if (
(error.statusCode === 500 || error.statusCode === 400) &&
error.message.includes('already exists')
) {
setFunctionInCache(functionName);
throw new RetryRequestError(`${functionName} already exists`);
}
Expand Down Expand Up @@ -199,6 +212,7 @@ const executeFaasFunction = async (
error.statusCode === 404 &&
error.message.includes(`error finding function ${functionName}`)
) {
removeFunctionFromCache(functionName);
await setupFaasFunction(functionName, null, versionId, libraryVersionIDs, testMode);
throw new RetryRequestError(`${functionName} not found`);
}
Expand Down

0 comments on commit d00c616

Please sign in to comment.