backend support for 'x' deliveries per process - x is configurable, more importantly any search starting with # is automatically a tag search. TODO: Need to extend this to people searches starting with @

This commit is contained in:
friendica 2012-05-19 02:42:11 -07:00
parent a49bd0a686
commit 513ef2410d
3 changed files with 416 additions and 399 deletions

View file

@ -38,7 +38,10 @@ function delivery_run($argv, $argc){
$cmd = $argv[1];
$item_id = intval($argv[2]);
$contact_id = intval($argv[3]);
for($x = 3; $x < $argc; $x ++) {
$contact_id = intval($argv[x]);
// Some other process may have delivered this item already.
@ -48,7 +51,7 @@ function delivery_run($argv, $argc){
dbesc($contact_id)
);
if(! count($r)) {
return;
continue;
}
$maxsysload = intval(get_config('system','maxloadavg'));
@ -71,7 +74,7 @@ function delivery_run($argv, $argc){
);
if((! $item_id) || (! $contact_id))
return;
continue;
$expire = false;
$top_level = false;
@ -92,7 +95,7 @@ function delivery_run($argv, $argc){
$uid = $item_id;
$item_id = 0;
if(! count($items))
return;
continue;
}
else {
@ -102,7 +105,7 @@ function delivery_run($argv, $argc){
);
if((! count($r)) || (! intval($r[0]['parent']))) {
return;
continue;
}
$target_item = $r[0];
@ -111,7 +114,7 @@ function delivery_run($argv, $argc){
$updated = $r[0]['edited'];
if(! $parent_id)
return;
continue;
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
@ -120,7 +123,7 @@ function delivery_run($argv, $argc){
);
if(! count($items)) {
return;
continue;
}
$icontacts = null;
@ -135,7 +138,7 @@ function delivery_run($argv, $argc){
);
}
if( ! ($icontacts && count($icontacts)))
return;
continue;
// avoid race condition with deleting entries
@ -159,7 +162,7 @@ function delivery_run($argv, $argc){
);
if(! count($r))
return;
continue;
$owner = $r[0];
@ -209,7 +212,7 @@ function delivery_run($argv, $argc){
logger('relay denied for delivery agent.');
/* no relay allowed for direct contact delivery */
return;
continue;
}
if((strlen($parent['allow_cid']))
@ -233,7 +236,7 @@ function delivery_run($argv, $argc){
require_once('include/salmon.php');
if($contact['self'])
return;
continue;
$deliver_status = 0;
@ -537,6 +540,7 @@ function delivery_run($argv, $argc){
default:
break;
}
}
return;
}

View file

@ -478,6 +478,12 @@ function notifier_run($argv, $argc){
}
}
$deliveries_per_process = intval(get_config('system','delivery_batch_count'));
if($deliveries_per_process <= 0)
$deliveries_per_process = 1;
$this_batch = array();
foreach($r as $contact) {
if($contact['self'])
continue;
@ -486,6 +492,7 @@ function notifier_run($argv, $argc){
// we will deliver single recipient types of message and email receipients here.
if((! $mail) && (! $fsuggest) && (! $followup)) {
// deliveries per process not yet implemented, 1 delivery per process.
proc_run('php','include/delivery.php',$cmd,$item_id,$contact['id']);
if($interval)
@time_sleep_until(microtime(true) + (float) $interval);

View file

@ -96,6 +96,12 @@ function search_content(&$a) {
$o .= search($search,'search-box','/search',((local_user()) ? true : false));
if(strpos($search,'#') === 0) {
$tag = true;
$search = substr($search,1);
}
if(! $search)
return $o;