noot
All checks were successful
commit-tag / commit-tag-image (map[context:./migrations file:./migrations/Dockerfile name:migrations]) (push) Successful in 18s
commit-tag / commit-tag-image (map[context:./ts file:./ts/Dockerfile name:ts]) (push) Successful in 57s

This commit is contained in:
a 2025-03-02 22:47:56 -06:00
parent 19799f2b0f
commit e8a37207f0
No known key found for this signature in database
GPG Key ID: 2F22877AA4DFDADB
2 changed files with 6 additions and 5 deletions

View File

@ -26,12 +26,12 @@ export async function update_wynn_items() {
const dataHash = sha1Hash(serializedData) const dataHash = sha1Hash(serializedData)
let found_new = false let found_new = false
await sql.begin(async (sql) => { await sql.begin(async (sql) => {
const [{currentHash} = {}] = await sql`select value as currentHash from meta.hashes where key = 'wynn.items' limit 1` const [{currenthash} = {}] = await sql`select value as currenthash from meta.hashes where key = 'wynn.items' limit 1`
if(currentHash === dataHash) { if(currenthash === dataHash) {
return return
} }
found_new = true found_new = true
log.info("updating wynn with new hash") log.info(`updating wynn with new hash`, {old: currenthash, new: dataHash})
for(const [displayName, item] of Object.entries(parsed)){ for(const [displayName, item] of Object.entries(parsed)){
const json = stringify(item) const json = stringify(item)
if(!json){ if(!json){
@ -45,7 +45,7 @@ export async function update_wynn_items() {
display_name = EXCLUDED.display_name, display_name = EXCLUDED.display_name,
type = EXCLUDED.type, type = EXCLUDED.type,
data = EXCLUDED.data, data = EXCLUDED.data,
itemHash = EXCLUDED.itemHash` hash = EXCLUDED.hash`
// update the hash // update the hash
await sql`insert into meta.hashes(key, value) values await sql`insert into meta.hashes(key, value) values
('wynn.items', ${dataHash}) ('wynn.items', ${dataHash})

View File

@ -10,5 +10,6 @@ const { update_wynn_items } = proxyActivities<typeof activities>({
}); });
export const workflowSyncItemDatabase = async() => { export const workflowSyncItemDatabase = async() => {
await update_wynn_items(); const {found_new} = await update_wynn_items();
} }