Skip to content

Commit

Permalink
Merge pull request #64 from EdgeApp/sam/debugging-changes
Browse files Browse the repository at this point in the history
Sam/debugging changes
  • Loading branch information
swansontec authored Feb 27, 2024
2 parents a2c1c01 + cb95cc8 commit 622fa96
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/daemons/priceChangeDaemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ runDaemon(async tools => {
logger.warn({ msg: 'Failed event', id, err })
}

heartbeat()
heartbeat(`row '${eventRow.id}'`)
}
})

Expand Down
5 changes: 3 additions & 2 deletions src/daemons/runDaemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ async function iterate(

const heartbeat = makeHeartbeat({
write: chunk => {
const [timeElapsed, item] = chunk.split(',')
const [timeElapsed, ...rest] = chunk.split(',')
const info = rest.join(',').trim()
logger.info(
{ timeElapsed: timeElapsed.trim(), item: item.trim() },
{ timeElapsed: timeElapsed.trim(), info },
'heartbeat %s',
chunk
)
Expand Down
2 changes: 2 additions & 0 deletions src/db/couchPushEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { PushEvent, PushTrigger } from '../types/pushTypes'
* To make changes, edit the `event` object, then call `save`.
*/
export interface PushEventRow {
id: string
event: PushEvent
save: () => Promise<void>
}
Expand Down Expand Up @@ -267,6 +268,7 @@ function makePushEventRow(
let base = { ...event }

return {
id: clean.id,
event,

async save(): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/util/heartbeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function makeHeartbeat(
if (seconds < nextSeconds) return
nextSeconds += logSeconds

let out = `${seconds.toFixed(2)}s, ${count} rows`
let out = `${seconds.toFixed(2)}s, ${count} beats`
if (item != null) out += `, ${item}`
out += '\n'
stderr.write(out)
Expand Down

0 comments on commit 622fa96

Please sign in to comment.