diff options
author | zotlabs <mike@macgirvin.com> | 2017-01-29 14:45:25 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-01-29 14:45:25 -0800 |
commit | d5d67708ac912fa863a062e3469eb4ac17e84cdf (patch) | |
tree | 86726237b4c0f11ab62dd04cc25cb1a223ac37a3 /install | |
parent | 5aa0017e91cac135ef8b84c138becb09decb1d58 (diff) | |
download | volse-hubzilla-d5d67708ac912fa863a062e3469eb4ac17e84cdf.tar.gz volse-hubzilla-d5d67708ac912fa863a062e3469eb4ac17e84cdf.tar.bz2 volse-hubzilla-d5d67708ac912fa863a062e3469eb4ac17e84cdf.zip |
Alter the queue so that each queue item stores the scheduled time of the next delivery. This keeps the query for
queued items simple. We no longer group by posturl; as the queue update function will only keep one item per destination
scheduled for shorter term processing. Others (multiple queued items for a single destination) will be scheduled for
delivery far into the future and only delivered if the hub responds to the "active" or short term queue item.
Diffstat (limited to 'install')
-rw-r--r-- | install/schema_mysql.sql | 2 | ||||
-rw-r--r-- | install/schema_postgres.sql | 2 | ||||
-rw-r--r-- | install/update.php | 21 |
3 files changed, 23 insertions, 2 deletions
diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index bd7d9d79c..be5317722 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -898,6 +898,7 @@ CREATE TABLE IF NOT EXISTS `outq` ( `outq_delivered` tinyint(1) NOT NULL DEFAULT '0', `outq_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `outq_updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `outq_scheduled` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `outq_notify` mediumtext NOT NULL, `outq_msg` mediumtext NOT NULL, `outq_priority` smallint(6) NOT NULL DEFAULT '0', @@ -907,6 +908,7 @@ CREATE TABLE IF NOT EXISTS `outq` ( KEY `outq_hub` (`outq_posturl`), KEY `outq_created` (`outq_created`), KEY `outq_updated` (`outq_updated`), + KEY `outq_scheduled` (`outq_scheduled`), KEY `outq_async` (`outq_async`), KEY `outq_delivered` (`outq_delivered`), KEY `outq_priority` (`outq_priority`) diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index f8e4ecf5f..e78425828 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -884,6 +884,7 @@ CREATE TABLE "outq" ( "outq_delivered" numeric(1) NOT NULL DEFAULT '0', "outq_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "outq_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "outq_scheduled" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "outq_notify" text NOT NULL, "outq_msg" text NOT NULL, "outq_priority" smallint NOT NULL DEFAULT '0', @@ -894,6 +895,7 @@ create index "outq_channel" on outq ("outq_channel"); create index "outq_hub" on outq ("outq_posturl"); create index "outq_created" on outq ("outq_created"); create index "outq_updated" on outq ("outq_updated"); +create index "outq_scheduled" on outq ("outq_scheduled"); create index "outq_async" on outq ("outq_async"); create index "outq_delivered" on outq ("outq_delivered"); create index "outq_priority" on outq ("outq_priority"); diff --git a/install/update.php b/install/update.php index 34f23b049..87cf4ba60 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1187 ); +define( 'UPDATE_VERSION' , 1188 ); /** * @@ -2484,11 +2484,28 @@ function update_r1185() { function update_r1186() { - $r1 = q("alter table profile add profile_vcard text not null default '' "); + $r1 = q("alter table profile add profile_vcard text not null"); if($r1) return UPDATE_SUCCESS; return UPDATE_FAILED; +} + +function update_r1187() { + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("alter table outq add outq_scheduled timestamp not null default '0001-01-01 00:00:00' "); + } + else { + $r1 = q("alter table outq add outq_scheduled datetime not null default '0001-01-01 00:00:00' "); + } + $r2 = q("create index outq_scheduled_idx on outq (outq_scheduled)"); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + + }
\ No newline at end of file |