noot
This commit is contained in:
parent
19799f2b0f
commit
e8a37207f0
@ -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})
|
||||||
|
@ -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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user