Skip to content

Commit

Permalink
chore: swapping out todo comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasgriffintn committed Mar 30, 2024
1 parent 6be3651 commit b0aee7e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 45 deletions.
37 changes: 9 additions & 28 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,29 @@
"replacements:all"
],
"rangeStrategy": "update-lockfile",
"supportPolicy": [
"lts_latest"
],
"supportPolicy": ["lts_latest"],
"dependencyDashboardAutoclose": true,
"platformAutomerge": true,
"vulnerabilityAlerts": {
"labels": [
"security"
],
"labels": ["security"],
"automerge": true
},
"stabilityDays": 3,
"packageRules": [
{
"matchUpdateTypes": [
"major"
],
"labels": [
"dependencies"
]
"matchUpdateTypes": ["major"],
"labels": ["dependencies"]
},
{
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
],
"labels": [
"dependencies"
],
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"labels": ["dependencies"],
"automerge": true
},
{
"groupName": "docker",
"matchDatasources": [
"docker"
],
"labels": [
"dependencies"
],
"matchDatasources": ["docker"],
"labels": ["dependencies"],
"automerge": true
}
]
}
}
23 changes: 12 additions & 11 deletions src/consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export class Consumer extends TypedEventEmitter {
);
})
.catch((err): void => {
// TODO: Adjust the error handling here
// TODO: Add an extension to the polling timeout if auth error
// This error handling should be expanded and improved to handle auth timeouts
// https://github.com/bbc/cloudflare-queue-consumer/issues/19
this.emit("error", err);
setTimeout(() => this.poll(), this.pollingWaitTimeMs);
})
Expand Down Expand Up @@ -235,14 +235,14 @@ export class Consumer extends TypedEventEmitter {
try {
this.emit("message_received", message);

// TODO: Invesitgate if we can do heartbear checks here like SQS Consumer
// https://github.com/bbc/sqs-consumer/blob/main/src/consumer.ts#L339
// At the moment, we don't extend timeouts on a heartbeat
// https://github.com/bbc/cloudflare-queue-consumer/issues/20

const ackedMessage: Message = await this.executeHandler(message);

if (ackedMessage?.id === message.id) {
// TODO: In order to conserve API reate limits, it would be better to do this
// in a batch, rather than one at a time.
// We should probably batch these up to reduce API rate limits
// https://github.com/bbc/cloudflare-queue-consumer/issues/21
await this.acknowledgeMessage([message], []);

this.emit("message_processed", message);
Expand All @@ -251,8 +251,8 @@ export class Consumer extends TypedEventEmitter {
this.emitError(err, message);

if (this.retryMessagesOnError) {
// TODO: In order to conserve API reate limits, it would be better to do this
// in a batch, rather than one at a time.
// We should probably batch these up to reduce API rate limits
// https://github.com/bbc/cloudflare-queue-consumer/issues/21
await this.acknowledgeMessage([], [message]);
}
}
Expand All @@ -268,8 +268,8 @@ export class Consumer extends TypedEventEmitter {
this.emit("message_received", message);
});

// TODO: Invesitgate if we can do heartbear checks here like SQS Consumer
// https://github.com/bbc/sqs-consumer/blob/main/src/consumer.ts#L375
// At the moment, we don't extend timeouts on a heartbeat
// https://github.com/bbc/cloudflare-queue-consumer/issues/20

const ackedMessages: Message[] = await this.executeBatchHandler(messages);

Expand Down Expand Up @@ -365,7 +365,8 @@ export class Consumer extends TypedEventEmitter {
retries: Message[],
): Promise<AckMessageResponse> {
try {
// TODO: this is pretty hacky, is there a better way to do this?
// This is pretty hacky, is there a better way to do this?
// https://github.com/bbc/cloudflare-queue-consumer/issues/22
const retriesWithDelay = retries.map((message) => ({
...message,
delay_seconds: this.retryMessageDelay,
Expand Down
12 changes: 6 additions & 6 deletions test/unit/consumer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,26 @@ describe("Consumer", () => {
});

describe(".start", () => {
// TODO: Implement tests for the .start method
// https://github.com/bbc/cloudflare-queue-consumer/pull/18
});

describe(".stop", () => {
// TODO: Implement tests for the .stop method
// https://github.com/bbc/cloudflare-queue-consumer/pull/18
});

describe(".status", () => {
// TODO: Implement tests for the .status method
// https://github.com/bbc/cloudflare-queue-consumer/pull/18
});

describe(".updateOption", () => {
// TODO: Implement tests for the .updateOption method
// https://github.com/bbc/cloudflare-queue-consumer/pull/18
});

describe("Event Listeners", () => {
// TODO: Implement tests for the event listeners
// https://github.com/bbc/cloudflare-queue-consumer/pull/18
});

describe("Logger", () => {
// TODO: Implement tests for the logger
// https://github.com/bbc/cloudflare-queue-consumer/pull/18
});
});

0 comments on commit b0aee7e

Please sign in to comment.