proletarian 2023-03-31

this might sound dumb - but im considering using proletariat's job table in...perhaps a strange way

specifically, on a trigger from another table inserting a job for proletarian to pick up

I need to do exactly the same

I ran into this problem, unfortunately: https://github.com/msolli/proletarian/issues/22

CREATE TABLE IF NOT EXISTS job (
    job_id      UUID PRIMARY KEY,   -- job id, generated and returned by proletarian.job/enqueue!
    queue       TEXT      NOT NULL, -- queue name
    job_type    TEXT      NOT NULL, -- job type
    payload     TEXT      NOT NULL, -- Transit-encoded job data
    attempts    INTEGER   NOT NULL, -- Number of attempts. Starts at 0. Increments when the job is processed.
    enqueued_at TIMESTAMP NOT NULL, -- When the job was enqueued (never changes)
    process_at  TIMESTAMP NOT NULL  -- When the job should be run (updates every retry)
);
I can edit this sql to make it a little easier on my end (default time on enqueued and processe_at and default value on attempts + job_id)

but the thing im kinda going.eeerg on is the payload

its pretty easy to make json in postgres for the job data, but if that json is "~" then its not valid transit

which is such a dumb edge case but im thinking about it

because it would mean that hypothetically putting a ~ at the start of some random fields would be a hidden bug

and I almost want to ask if there is a way i could mark that the payload is actually json encoded

you know what, :proletarian/serializer might be the thing. Just need to always use json

👍 1