Skip to content

Commit

Permalink
Merge pull request #69 from guidesmiths/perf/update-deprecations
Browse files Browse the repository at this point in the history
perf: update deprecations
  • Loading branch information
Bounteous17 authored Jul 1, 2022
2 parents 106f8dd + c6a740f commit 8ac6991
Show file tree
Hide file tree
Showing 12 changed files with 4,641 additions and 2,348 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"requireForBlockBody": false
}
],
"object-curly-newline": "off"
"object-curly-newline": "off",
"no-async-promise-executor": "off"
}
}
35 changes: 35 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### Type:
* ~cicd: helm, docker & cicd adjustments.~
* ~feature: new capabilities.~
* ~fix: bug, hotfix, etc.~
* ~refactor: enhacements.~
* ~other: docs, tests.~

### What's the focus of this PR:
Description of the PR contents. Tasks involved in its development can be listed below.

### Task list:

:floppy_disk: **Database**
- [ ] Task description

:cyclone: **Components**
- [ ] Task description

:satellite: **API**
- [ ] Task description

:heavy_check_mark: **Test**
- [ ] Task description

:bug: **Bug fixes**
- [ ] Task description

:arrows_counterclockwise: **Refactor**
- [ ] Task description

:memo: **Documentation**
- [ ] Task description

:whale: **Project configuration**
- [ ] Task description
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
steps:
- uses: actions/checkout@v2
- name: Set up Node.js version ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ module.exports = () => {
}
};


debug(`Starting subscription ${subscriptionId} on topic ${topic}...`);
const openSubscription = receiver.subscribe({
processMessage: onMessageHandler,
Expand Down Expand Up @@ -228,11 +227,13 @@ module.exports = () => {

let timer;
// eslint-disable-next-line no-return-assign
const checkIfSubscriptionIsEmpty = () => new Promise(resolve => timer = setInterval(async () => {
debug(`Trying to stop component | ${enqueuedItems} enqueued items remaining`);
// eslint-disable-next-line no-unused-expressions
enqueuedItems === 0 && resolve();
}, 100));
const checkIfSubscriptionIsEmpty = () => new Promise(resolve => {
timer = setInterval(async () => {
debug(`Trying to stop component | ${enqueuedItems} enqueued items remaining`);
// eslint-disable-next-line no-unused-expressions
enqueuedItems === 0 && resolve();
}, 100);
});
await checkIfSubscriptionIsEmpty();
clearInterval(timer);

Expand Down
2 changes: 0 additions & 2 deletions lib/errorStrategies/exponentialBackoff.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = (topic, topicClientFactory, receiver) => async (brokeredMessage
return newMessage;
};


const reschedule = async (message, msgAttempt) => {
const calculateNextAttempt = messageAttempt => BACKOFF_FACTOR ** messageAttempt;
const calculateScheduledTime = (nextAttempt, measure) => moment().add(nextAttempt, measure).toDate().getTime();
Expand All @@ -43,7 +42,6 @@ module.exports = (topic, topicClientFactory, receiver) => async (brokeredMessage
]);
};


if (limitReached) {
debug(`Maximum number of deliveries (${attemptsLimit}) reached on topic ${topic}. Sending to dlq...`);
await deadLetter(topic, receiver)(brokeredMessage);
Expand Down
Loading

0 comments on commit 8ac6991

Please sign in to comment.