Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Commit

Permalink
Fixed histrorization prematurely stoping heartbeats
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasK33 committed Feb 23, 2021
1 parent 4f3b20f commit c779528
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion devops/kubernetes/src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export class Cluster extends Chart {
"delivery.timeout.ms": 15 * 60 * 1000, // 15 minutes
"session.timeout.ms": 30 * 1000, // 30 seconds
"heartbeat.interval.ms": 10 * 1000, // 10 seconds
"max.poll.interval.ms": 15 * 60 * 1000, // 5 minutes
"max.poll.interval.ms": 15 * 60 * 1000, // 15 minutes
"max.poll.records": 10,
"auto.offset.reset": "earliest",
},
Expand Down
4 changes: 2 additions & 2 deletions services/historization/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 services/historization/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "historization",
"version": "1.12.0",
"version": "1.12.1",
"description": "A historization service responsible for persisting info",
"author": {
"name": "Thomas Kosiewski"
Expand Down
17 changes: 10 additions & 7 deletions services/historization/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const {
isRunning,
isStale,
}) => {
await heartbeat();
const intervalId = setInterval(async () => {
try {
await heartbeat();
Expand Down Expand Up @@ -155,6 +156,12 @@ const {
} else {
end({ status: 501 });
}

if (KAFKA_AUTO_COMMIT !== "false") {
resolveOffset(message.offset);
} else {
await commitOffsetsIfNecessary();
}
} catch (e) {
const exceptionID = captureException(e, {
contexts: {
Expand Down Expand Up @@ -187,17 +194,13 @@ const {

end({ status: 500 });

throw e;
} finally {
clearInterval(intervalId);
}

if (KAFKA_AUTO_COMMIT !== "false") {
resolveOffset(message.offset);
} else {
await commitOffsetsIfNecessary();
throw e;
}
}

clearInterval(intervalId);
},
});

Expand Down

0 comments on commit c779528

Please sign in to comment.