[HttpKernel] Removed useless else
This commit is contained in:
parent
fc42cc5066
commit
1fcb99b936
@ -456,32 +456,30 @@ class HttpCache implements HttpKernelInterface
|
|||||||
|
|
||||||
// server the stale response while there is a revalidation
|
// server the stale response while there is a revalidation
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
// wait for the lock to be released
|
|
||||||
$wait = 0;
|
|
||||||
while (file_exists($lock) && $wait < 5000000) {
|
|
||||||
usleep($wait += 50000);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($wait < 2000000) {
|
|
||||||
// replace the current entry with the fresh one
|
|
||||||
$new = $this->lookup($request);
|
|
||||||
$entry->headers = $new->headers;
|
|
||||||
$entry->setContent($new->getContent());
|
|
||||||
$entry->setStatusCode($new->getStatusCode());
|
|
||||||
$entry->setProtocolVersion($new->getProtocolVersion());
|
|
||||||
$entry->setCookies($new->getCookies());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
// backend is slow as hell, send a 503 response (to avoid the dog pile effect)
|
|
||||||
$entry->setStatusCode(503);
|
|
||||||
$entry->setContent('503 Service Unavailable');
|
|
||||||
$entry->headers->set('Retry-After', 10);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wait for the lock to be released
|
||||||
|
$wait = 0;
|
||||||
|
while (file_exists($lock) && $wait < 5000000) {
|
||||||
|
usleep($wait += 50000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($wait < 2000000) {
|
||||||
|
// replace the current entry with the fresh one
|
||||||
|
$new = $this->lookup($request);
|
||||||
|
$entry->headers = $new->headers;
|
||||||
|
$entry->setContent($new->getContent());
|
||||||
|
$entry->setStatusCode($new->getStatusCode());
|
||||||
|
$entry->setProtocolVersion($new->getProtocolVersion());
|
||||||
|
$entry->setCookies($new->getCookies());
|
||||||
|
} else {
|
||||||
|
// backend is slow as hell, send a 503 response (to avoid the dog pile effect)
|
||||||
|
$entry->setStatusCode(503);
|
||||||
|
$entry->setContent('503 Service Unavailable');
|
||||||
|
$entry->headers->set('Retry-After', 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we have the lock, call the backend
|
// we have the lock, call the backend
|
||||||
|
@ -78,9 +78,9 @@ class Store implements StoreInterface
|
|||||||
$this->locks[] = $path;
|
$this->locks[] = $path;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return $path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,12 +125,12 @@ class Store implements StoreInterface
|
|||||||
list($req, $headers) = $match;
|
list($req, $headers) = $match;
|
||||||
if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) {
|
if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) {
|
||||||
return $this->restoreResponse($headers, $body);
|
return $this->restoreResponse($headers, $body);
|
||||||
} else {
|
|
||||||
// TODO the metaStore referenced an entity that doesn't exist in
|
|
||||||
// the entityStore. We definitely want to return nil but we should
|
|
||||||
// also purge the entry from the meta-store when this is detected.
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO the metaStore referenced an entity that doesn't exist in
|
||||||
|
// the entityStore. We definitely want to return nil but we should
|
||||||
|
// also purge the entry from the meta-store when this is detected.
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,9 +73,9 @@ class SqliteProfilerStorage implements ProfilerStorageInterface
|
|||||||
$this->close($db);
|
$this->close($db);
|
||||||
if (isset($data[0]['data'])) {
|
if (isset($data[0]['data'])) {
|
||||||
return array($data[0]['data'], $data[0]['ip'], $data[0]['url'], $data[0]['time']);
|
return array($data[0]['data'], $data[0]['ip'], $data[0]['url'], $data[0]['time']);
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user