IceCactus
IceCactus
WWindmill
Created by IceCactus on 11/29/2023 in #help
crash
windmilldev-db-1 | 2023-11-29 19:07:23.202 UTC [1] LOG: server process (PID 439) was terminated by signal 9: Killed windmilldev-db-1 | 2023-11-29 19:07:23.202 UTC [1] DETAIL: Failed process was running: UPDATE queue windmilldev-db-1 | SET running = true windmilldev-db-1 | , started_at = coalesce(started_at, now()) windmilldev-db-1 | , last_ping = now() windmilldev-db-1 | , suspend_until = null windmilldev-db-1 | WHERE id = ( windmilldev-db-1 | SELECT id windmilldev-db-1 | FROM queue windmilldev-db-1 | WHERE running = false AND scheduled_for <= now() AND tag = ANY($1) windmilldev-db-1 | ORDER BY priority DESC NULLS LAST, scheduled_for, created_at windmilldev-db-1 | FOR UPDATE SKIP LOCKED windmilldev-db-1 | LIMIT 1 windmilldev-db-1 | ) windmilldev-db-1 | RETURNING * Any idea what is cuasing this? self hosted
76 replies
WWindmill
Created by IceCactus on 11/17/2023 in #help
Why does this code sometimes work but 95% of the time it doesnt.
import * as wmill from "windmill-client" import { Client } from "pg" import { from as copyFrom } from "pg-copy-streams" // Defining the type for Postgres resource type Postgresql = { host: string, port: number, user: string, dbname: string, sslmode: string, password: string, root_certificate_pem: string } export async function main(csvFile: string, postgresqlResource: Postgresql) { //Start up db connection //Creating a new postgres client const client = new Client({ user: postgresqlResource.user, database: postgresqlResource.dbname, password: postgresqlResource.password, host: postgresqlResource.host, // Changed from hostname to host port: postgresqlResource.port }); let stream; const time = new Date().toISOString(); try { await client.connect(); //test to make sure connection is working. //await client.query("INSERT INTO inventory (sku,warehouse_id,time,qty) VALUES ('test',2,now(),25)"); stream = await client.query(copyFrom('COPY inventory (sku,warehouse_id,time,qty) FROM STDIN')); let numOfRows = 0; stream.write('partnumber' + '\t' + '2' + '\t' + time + '\t' + '43' + '\n'); //await stream.end(); } catch (e) { console.log(e); } finally { stream.end(); } Disclaimer: Im learning javascript. Im trying to bulk import into postgres using BUN. For some reason, randomly this work work like i expect but 95% of the time i run the script it won't. If i uncomment the insert, that will work 100% of the time.
26 replies