forked from the-distro/ofborg
add label event, debugging for mass rebuild filtering
This commit is contained in:
parent
06dff2fe72
commit
aa8840159b
|
@ -33,6 +33,7 @@ function outrunner($msg) {
|
|||
}
|
||||
|
||||
function runner($msg) {
|
||||
echo "Msg Sha: " . md5($msg->body) . "\n";
|
||||
$in = json_decode($msg->body);
|
||||
|
||||
try {
|
||||
|
@ -92,7 +93,7 @@ function runner($msg) {
|
|||
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
|
||||
return true;
|
||||
} else {
|
||||
echo "so-called interesting event: " . $in->action . "\n";
|
||||
echo "so-called interesting event on #" . $in->number . ": " . $in->action . "\n";
|
||||
}
|
||||
|
||||
$forward = [
|
||||
|
|
|
@ -64,6 +64,10 @@ class EventClassifier {
|
|||
return "project_column";
|
||||
}
|
||||
|
||||
if (self::isLabelEvent($payload)) {
|
||||
return "label";
|
||||
}
|
||||
|
||||
throw new EventClassifierUnknownException();
|
||||
}
|
||||
|
||||
|
@ -169,6 +173,12 @@ class EventClassifier {
|
|||
return isset($payload->project_column);
|
||||
}
|
||||
|
||||
public static function isLabelEvent($payload) {
|
||||
return isset($payload->label)
|
||||
&& isset($payload->action)
|
||||
&& in_array($payload->action,
|
||||
['created', 'edited', 'deleted']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue