Skip to content

Commit

Permalink
fix: better timeout error fingerprinting
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Aug 2, 2023
1 parent bc24f78 commit 534452e
Show file tree
Hide file tree
Showing 3 changed files with 694 additions and 621 deletions.
2 changes: 1 addition & 1 deletion src/DatastoreStreamReadable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
},
)
} catch (err) {
console.error(
console.log(
`DatastoreStreamReadable error!\n`,
{
table: this.table,
Expand Down
7 changes: 6 additions & 1 deletion src/datastore.db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const RETRY_ON = [
// Examples of errors:
// UNKNOWN: Stream removed

const DATASTORE_TIMEOUT = 'DATASTORE_TIMEOUT'

const methodMap: Record<CommonDBSaveMethod, string> = {
insert: 'insert',
update: 'update',
Expand Down Expand Up @@ -154,7 +156,7 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
timeout: this.cfg.timeout,
errorData: {
// This error will be grouped ACROSS all endpoints and usages
fingerprint: ['DATASTORE_TIMEOUT'],
fingerprint: [DATASTORE_TIMEOUT],
},
})
rows = r[0]
Expand Down Expand Up @@ -540,6 +542,9 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
logFailures: true,
// logAll: true,
logger: this.cfg.logger,
errorData: {
fingerprint: [DATASTORE_TIMEOUT],
},
}
}
}
Loading

0 comments on commit 534452e

Please sign in to comment.