on master help sign in
Reduced database notification payload (#43)

Because PostgreSQL limits notification payloads to 8000 bytes by default, passing the full job record in the notification artificially limits the job payload size. By passing only required fields in the notification, this limitation is removed.

commit75a088492d171801a6ccc80a522984b13ea18359 authormrputty <47194789+mrputty@users.noreply.github.com> dateTue 13 Oct 2020, 01:18 (6 years ago) parentb269ce4
1 file changed+2−1
src/OddJobs/Migrations.hs+2−1
src/OddJobs/Migrations.hs+2−1
@@ -32,7 +32,8 @@ createJobTableQuery tname = "CREATE TABLE " <> tname <>
3232createNotificationTrigger :: TableName -> Query
3333createNotificationTrigger tname = "create or replace function " <> fnName <> "() returns trigger as $$" <>
3434 "begin \n" <>
35− " perform pg_notify('" <> pgEventName tname <> "', row_to_json(new)::text); \n" <>
35+ " perform pg_notify('" <> pgEventName tname <> "', \n" <>
36+ " json_build_object('id', new.id, 'run_at', new.run_at, 'locked_at', new.locked_at)::text); \n" <>
3637 " return new; \n" <>
3738 "end; \n" <>
3839 "$$ language plpgsql;" <>