this should improve queue performance dramatically.
This commit is contained in:
parent
235b033560
commit
50a7e9ce8f
@ -69,11 +69,12 @@ function directory_run($argv, $argc){
|
||||
// the directory packet. That means we'll try again on the next poll run.
|
||||
|
||||
$hash = random_string();
|
||||
q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg )
|
||||
values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg )
|
||||
values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
dbesc($hash),
|
||||
intval($channel['channel_account_id']),
|
||||
intval($channel['channel_id']),
|
||||
dbesc('zot'),
|
||||
dbesc($url),
|
||||
intval(1),
|
||||
dbesc(datetime_convert()),
|
||||
|
@ -486,10 +486,11 @@ function notifier_run($argv, $argc){
|
||||
$hash = random_string();
|
||||
if($packet_type === 'refresh' || $packet_type === 'purge') {
|
||||
$n = zot_build_packet($channel,$packet_type);
|
||||
q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
dbesc($hash),
|
||||
intval($channel['channel_account_id']),
|
||||
intval($channel['channel_id']),
|
||||
dbesc('zot'),
|
||||
dbesc($hub['hubloc_callback']),
|
||||
intval(1),
|
||||
dbesc(datetime_convert()),
|
||||
@ -500,10 +501,11 @@ function notifier_run($argv, $argc){
|
||||
}
|
||||
else {
|
||||
$n = zot_build_packet($channel,'notify',$env_recips,(($private) ? $hub['hubloc_sitekey'] : null),$hash);
|
||||
q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
dbesc($hash),
|
||||
intval($target_item['aid']),
|
||||
intval($target_item['uid']),
|
||||
dbesc('zot'),
|
||||
dbesc($hub['hubloc_callback']),
|
||||
intval(1),
|
||||
dbesc(datetime_convert()),
|
||||
|
@ -33,8 +33,12 @@ function queue_run($argv, $argc){
|
||||
|
||||
// For the first 12 hours we'll try to deliver every 15 minutes
|
||||
// After that, we'll only attempt delivery once per hour.
|
||||
|
||||
$r = q("SELECT * FROM outq WHERE outq_delivered = 0 and (( outq_created > UTC_TIMESTAMP() - INTERVAL 12 HOUR and outq_updated < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ) OR ( outq_updated < UTC_TIMESTAMP() - INTERVAL 1 HOUR ))");
|
||||
// This currently only handles the default queue drivers ('zot' or '') which we will group by posturl
|
||||
// so that we don't start off a thousand deliveries for a couple of dead hubs.
|
||||
// The zot driver will deliver everything destined for a single hub once contact is made (*if* contact is made).
|
||||
// Other drivers will have to do something different here and may need their own query.
|
||||
|
||||
$r = q("SELECT * FROM outq WHERE outq_delivered = 0 and (( outq_created > UTC_TIMESTAMP() - INTERVAL 12 HOUR and outq_updated < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ) OR ( outq_updated < UTC_TIMESTAMP() - INTERVAL 1 HOUR )) and outq_driver in ('','zot') group by outq_posturl");
|
||||
}
|
||||
if(! $r)
|
||||
return;
|
||||
|
@ -2074,10 +2074,11 @@ function build_sync_packet($uid = 0, $packet = null) {
|
||||
foreach($synchubs as $hub) {
|
||||
$hash = random_string();
|
||||
$n = zot_build_packet($channel,'notify',$env_recips,$hub['hubloc_sitekey'],$hash);
|
||||
q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
dbesc($hash),
|
||||
intval($channel['channel_account']),
|
||||
intval($channel['channel_id']),
|
||||
dbesc('zot'),
|
||||
dbesc($hub['hubloc_callback']),
|
||||
intval(1),
|
||||
dbesc(datetime_convert()),
|
||||
|
Reference in New Issue
Block a user