File: pgq_core_tx_limit.sql

package info (click to toggle)
pgq 3.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 808 kB
  • sloc: sql: 3,442; ansic: 2,013; python: 309; makefile: 84; sh: 1
file content (26 lines) | stat: -rw-r--r-- 872 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
\set VERBOSITY 'terse'
set client_min_messages = 'warning';

select pgq.create_queue('queue_tx_limit');

-- test limit
update pgq.queue set queue_per_tx_limit = 2 where queue_name = 'queue_tx_limit';
begin;
select pgq.insert_event('queue_tx_limit', 'test', 'event1');
select pgq.insert_event('queue_tx_limit', 'test', 'event2');
select pgq.insert_event('queue_tx_limit', 'test', 'event3');
end;

update pgq.queue set queue_per_tx_limit = 0 where queue_name = 'queue_tx_limit';
begin;
select pgq.insert_event('queue_tx_limit', 'test', 'event1');
end;

update pgq.queue set queue_per_tx_limit = null where queue_name = 'queue_tx_limit';
begin;
select pgq.insert_event('queue_tx_limit', 'test', 'event1');
select pgq.insert_event('queue_tx_limit', 'test', 'event2');
select pgq.insert_event('queue_tx_limit', 'test', 'event3');
end;

select pgq.drop_queue('queue_tx_limit');