Skip to content

Commit

Permalink
♻️ chore: console for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
yunsii committed Mar 22, 2024
1 parent 1d5d254 commit 567f7e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/worker/_helpers/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ export interface DataV1 {

export async function upsertKvStore(value: DataV1 | null, allMonitors: Monitor[]) {
ensureWorkerEnv()
const result = await (value === null
? KV_STORE.delete(DATA_KEY)
: KV_STORE.put(DATA_KEY, JSON.stringify(cleanDataV1(value, allMonitors))))
return result
if (value === null) {
await KV_STORE.delete(DATA_KEY)
return
}
const cleanedValue = cleanDataV1(value, allMonitors)
// eslint-disable-next-line no-console
console.log('🚀 ~ file: store.ts:76 ~ upsertKvStore ~ cleanedValue:', cleanedValue)
await KV_STORE.put(DATA_KEY, JSON.stringify(cleanedValue))
}

export async function cleanDataV1(value: DataV1, allMonitors: Monitor[]) {
Expand Down
1 change: 1 addition & 0 deletions src/worker/cron/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export async function handleCronTrigger(event: FetchEvent) {
subrequests.required()
const checkDay = getDate()
const { kvData } = await getStore()
console.log('🚀 ~ file: index.ts:24 ~ handleCronTrigger ~ kvData:', kvData)
subrequests.required()

const { uncheckMonitors, lastCheckedMonitorIds, allMonitors } = await prepareMonitors()
Expand Down

0 comments on commit 567f7e9

Please sign in to comment.