Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError for userSecondarySyncMetrics #3668

Merged
merged 3 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ module.exports = function (
prometheusRegistry: any
) {
return async function (jobId: string, resultString: string) {
// Create a logger so that we can filter logs by the tag `jobId` = <id of the job that successfully completed>
const logger = createChildLogger(baseLogger, { jobId })
// Create a logger so that we can filter logs by the tags `queue` and `jobId` = <id of the job that successfully completed>
const logger = createChildLogger(baseLogger, {
queue: nameOfQueueWithCompletedJob,
theoilie marked this conversation as resolved.
Show resolved Hide resolved
jobId
})

// update-replica-set jobs need enabledReconfigModes as an array.
// `this` comes from the function being bound via .bind() to ./index.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ module.exports = async function ({
for (const user of users) {
const { wallet, primary, secondary1, secondary2 } = user

const userSecondarySyncMetrics = userSecondarySyncMetricsMap[wallet] || {
[secondary1]: { successRate: 1, failureCount: 0 },
[secondary2]: { successRate: 1, failureCount: 0 }
const userSecondarySyncMetrics = {
[secondary1]: { successRate: 1, failureCount: 0, successCount: 0 },
[secondary2]: { successRate: 1, failureCount: 0, successCount: 0 },
...userSecondarySyncMetricsMap[wallet]
}
logger.info(
`Finding sync requests for user ${JSON.stringify(
user
)} with secondarySyncMetrics ${JSON.stringify(userSecondarySyncMetrics)}`
)

const {
syncReqsToEnqueue: userSyncReqsToEnqueue,
Expand Down