improve Nexus boot

This commit is contained in:
xiaomlove
2022-04-07 15:44:43 +08:00
parent 25a4cdfafc
commit ebe47b1ba3
4 changed files with 34 additions and 48 deletions
-2
View File
@@ -134,8 +134,6 @@ class Test extends Command
// $key = "dddd1";
// $model = \App\Models\TorrentSecret::query()->where('id', 1)->first();
// \Nexus\Database\NexusDB::cache_put($key, $model);
$value = NexusDB::cache_get("tracker_report_authkey_secret:1:10002");
dd($value);
}
+1 -1
View File
@@ -98,7 +98,7 @@ class Peer extends NexusModel
} else {
$this->connectable = self::CONNECTABLE_NO;
}
Cache::put($cacheKey, $this->connectable, 600);
Cache::put($cacheKey, $this->connectable, 3600);
$log .= ", do check, connectable: " . $this->connectable;
} else {
$log .= ", don't do check";
+5 -2
View File
@@ -826,19 +826,22 @@ class TrackerRepository extends BaseRepository
private function checkScrapeFields(Request $request): array
{
preg_match_all('/info_hash=([^&]*)/i', urldecode($request->getQueryString()), $info_hash_match);
preg_match_all('/info_hash=([^&]*)/i', $request->getQueryString(), $info_hash_match);
$info_hash_array = $info_hash_match[1];
$info_hash_original = [];
if (count($info_hash_array) < 1) {
throw new TrackerException("key: info_hash is Missing !");
} else {
foreach ($info_hash_array as $item) {
$item = urldecode($item);
if (($length = strlen($item)) != 20) {
throw new TrackerException("Invalid info_hash ! info_hash is not 20 bytes long($length)");
}
$info_hash_original[] = $item;
}
}
return $info_hash_array;
return $info_hash_original;
}
/**