Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/configuration/AphrontApplicationConfiguration.php
Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | $multimeter->newEvent( | ||||
PhabricatorStartup::getMicrosecondsSinceStart()); | PhabricatorStartup::getMicrosecondsSinceStart()); | ||||
$access_log->write(); | $access_log->write(); | ||||
$multimeter->saveEvents(); | $multimeter->saveEvents(); | ||||
DarkConsoleXHProfPluginAPI::saveProfilerSample($access_log); | DarkConsoleXHProfPluginAPI::saveProfilerSample($access_log); | ||||
// Add points to the rate limits for this request. | PhabricatorStartup::disconnectRateLimits( | ||||
$rate_token = PhabricatorStartup::getRateLimitToken(); | array( | ||||
if ($rate_token !== null) { | 'viewer' => $request->getUser(), | ||||
// The base score for a request allows users to make 30 requests per | )); | ||||
// minute. | |||||
$score = (1000 / 30); | |||||
// If the user was logged in, let them make more requests. | |||||
if ($request->getUser() && $request->getUser()->getPHID()) { | |||||
$score = $score / 5; | |||||
} | |||||
PhabricatorStartup::addRateLimitScore($rate_token, $score); | |||||
} | |||||
if ($processing_exception) { | if ($processing_exception) { | ||||
throw $processing_exception; | throw $processing_exception; | ||||
} | } | ||||
} | } | ||||
public function processRequest( | public function processRequest( | ||||
▲ Show 20 Lines • Show All 493 Lines • Show Last 20 Lines |