noot
This commit is contained in:
parent
19799f2b0f
commit
e8a37207f0
@ -26,12 +26,12 @@ export async function update_wynn_items() {
|
||||
const dataHash = sha1Hash(serializedData)
|
||||
let found_new = false
|
||||
await sql.begin(async (sql) => {
|
||||
const [{currentHash} = {}] = await sql`select value as currentHash from meta.hashes where key = 'wynn.items' limit 1`
|
||||
if(currentHash === dataHash) {
|
||||
const [{currenthash} = {}] = await sql`select value as currenthash from meta.hashes where key = 'wynn.items' limit 1`
|
||||
if(currenthash === dataHash) {
|
||||
return
|
||||
}
|
||||
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)){
|
||||
const json = stringify(item)
|
||||
if(!json){
|
||||
@ -45,7 +45,7 @@ export async function update_wynn_items() {
|
||||
display_name = EXCLUDED.display_name,
|
||||
type = EXCLUDED.type,
|
||||
data = EXCLUDED.data,
|
||||
itemHash = EXCLUDED.itemHash`
|
||||
hash = EXCLUDED.hash`
|
||||
// update the hash
|
||||
await sql`insert into meta.hashes(key, value) values
|
||||
('wynn.items', ${dataHash})
|
||||
|
@ -10,5 +10,6 @@ const { update_wynn_items } = proxyActivities<typeof activities>({
|
||||
});
|
||||
|
||||
export const workflowSyncItemDatabase = async() => {
|
||||
await update_wynn_items();
|
||||
const {found_new} = await update_wynn_items();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user