Skip to content

Commit ee21ade

Browse files
authored
Merge pull request #3125 from catchpoint/priority_changes
Change queue priorities
2 parents 2ca395e + aac9ae1 commit ee21ade

File tree

2 files changed

+32
-15
lines changed

2 files changed

+32
-15
lines changed

www/common/AttachUser.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@
114114
}
115115
}
116116

117-
if ($user->isPaid() || $user->isApiUser()) {
118-
//calculate based on paid priority
119-
$user->setUserPriority((int)Util::getSetting('paid_priority', 0));
117+
if ($user->isApiUser()) {
118+
$user->setUserPriority((int) Util::getSetting('api_priority', 7));
119+
} elseif ($user->isPaid()) {
120+
$user->setUserPriority((int) Util::getSetting('paid_priority', 6));
121+
} elseif ($user->isFree()) {
122+
$user->setUserPriority((int) Util::getSetting('user_priority', 8));
120123
} else {
121-
$user->setUserPriority((int)Util::getSetting('user_priority', 0));
124+
$user->setUserPriority((int) Util::getSetting('anon_priority', 9));
122125
}
123126

124127
$user_email = $user->getEmail();

www/runtest.php

+25-11
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
}
147147
if (array_key_exists('resubmit', $_POST)) {
148148
$test = GetTestInfo(trim($_POST['resubmit']));
149-
if (array_key_exists('key', $test)){
149+
if (array_key_exists('key', $test)) {
150150
$test['key'] = null;
151151
}
152152
if ($test) {
@@ -221,7 +221,7 @@
221221
$is_private = 0;
222222

223223
$is_private_api_call = !empty($user_api_key) && !empty($req_private) &&
224-
((int)$req_private == 1 || $req_private == 'true');
224+
((int)$req_private == 1 || $req_private == 'true');
225225
$is_private_web_call = $isPaid && ($_POST['private'] == 'on');
226226

227227
if ($is_private_api_call || $is_private_web_call) {
@@ -671,7 +671,7 @@
671671
if ((isset($test['batch']) && $test['batch']) || (isset($test['batch_locations']) && $test['batch_locations'])) {
672672
$test['priority'] = intval(GetSetting('bulk_priority', 7));
673673
} elseif ($_SERVER['REQUEST_METHOD'] == 'GET' || $xml || $json) {
674-
$test['priority'] = intval(GetSetting('api_priority', 5));
674+
$test['priority'] = intval(GetSetting('api_priority', 7));
675675
}
676676
}
677677

@@ -1635,7 +1635,7 @@ function ValidateKey(&$test, &$error, $key = null)
16351635
) {
16361636
$test['location'] = $keys[$key]['default location'];
16371637
}
1638-
$api_priority = intval(GetSetting('api_priority', 5));
1638+
$api_priority = intval(GetSetting('api_priority', 7));
16391639
$test['priority'] = $api_priority;
16401640
if (isset($keys[$key]['priority'])) {
16411641
$test['priority'] = intval($keys[$key]['priority']);
@@ -1726,9 +1726,8 @@ function ValidateKey(&$test, &$error, $key = null)
17261726
// Store the account info with the test
17271727
$test['accountId'] = $account['accountId'];
17281728
$test['contactId'] = $account['contactId'];
1729-
// success. See if there is a priority override for redis-based API tests
1730-
if (Util::getSetting('paid_priority')) {
1731-
$test['priority'] = intval(Util::getSetting('paid_priority'));
1729+
if (Util::getSetting('api_priority')) {
1730+
$test['priority'] = intval(Util::getSetting('api_priority'));
17321731
}
17331732
} else {
17341733
$error = 'The test request will exceed the remaining test balance for the given API key';
@@ -1834,9 +1833,24 @@ function ValidateParameters(&$test, $locations, &$error, $destination_url = null
18341833

18351834
// make sure on/off options are explicitly 1 or 0
18361835
$values = array(
1837-
'private', 'web10', 'ignoreSSL', 'tcpdump', 'standards', 'lighthouse',
1838-
'timeline', 'swrender', 'netlog', 'spdy3', 'noscript', 'fullsizevideo',
1839-
'blockads', 'sensitive', 'pngss', 'bodies', 'htmlbody', 'pss_advanced',
1836+
'private',
1837+
'web10',
1838+
'ignoreSSL',
1839+
'tcpdump',
1840+
'standards',
1841+
'lighthouse',
1842+
'timeline',
1843+
'swrender',
1844+
'netlog',
1845+
'spdy3',
1846+
'noscript',
1847+
'fullsizevideo',
1848+
'blockads',
1849+
'sensitive',
1850+
'pngss',
1851+
'bodies',
1852+
'htmlbody',
1853+
'pss_advanced',
18401854
'noheaders'
18411855
);
18421856
foreach ($values as $value) {
@@ -3562,7 +3576,7 @@ function CheckRateLimit($test, &$error, &$errorTitle)
35623576

35633577
$errorTemplate = "<p>Don't worry! You can keep testing for free once you log in, which will give you access to other excellent features like:</p>";
35643578
$errorTitleTemplate = "You've reached the limit for";
3565-
3579+
35663580
if (!$passesMonthly) {
35673581
$errorTitle = "{$errorTitleTemplate} this month";
35683582
$error = $errorTemplate;

0 commit comments

Comments
 (0)