Added WS_DEBUG_IMPORT to save invalid GUIDs responses from server.
This commit is contained in:
@@ -324,6 +324,7 @@ None that we are aware of.
|
||||
- (string) `WS_CRON_CACHE_AT` cron expression timer.
|
||||
- (string) `WS_LOGS_PRUNE_AFTER` Delete logs older than specified time, set to `disable` to disable logs pruning. it
|
||||
follows php [strtotime](https://www.php.net/strtotime) function rules.
|
||||
- (bool) `WS_DEBUG_IMPORT` Whether to log invalid GUID items from server in `${WS_TMP_DIR}/debug`.
|
||||
|
||||
# Container specific environment variables
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ return (function () {
|
||||
];
|
||||
|
||||
$config['debug'] = [
|
||||
'import' => (bool)env('WS_DEBUG_IMPORT', false),
|
||||
'profiler' => [
|
||||
'options' => [
|
||||
'save.handler' => 'file',
|
||||
|
||||
@@ -9,4 +9,5 @@ return [
|
||||
'%(tmpDir)/cache',
|
||||
'%(tmpDir)/profiler',
|
||||
'%(tmpDir)/webhooks',
|
||||
'%(tmpDir)/debug',
|
||||
];
|
||||
|
||||
@@ -48,6 +48,10 @@ final class PruneCommand extends Command
|
||||
'path' => Config::get('tmpDir') . '/webhooks',
|
||||
'filter' => '*.json',
|
||||
],
|
||||
[
|
||||
'path' => Config::get('tmpDir') . '/debug',
|
||||
'filter' => '*.json',
|
||||
],
|
||||
];
|
||||
|
||||
/** @var array<SplFileInfo> $files */
|
||||
|
||||
@@ -1141,11 +1141,21 @@ class JellyfinServer implements ServerInterface
|
||||
}
|
||||
|
||||
if (!$this->hasSupportedIds((array)($item->ProviderIds ?? []))) {
|
||||
if (true === Config::get('debug.import')) {
|
||||
$name = $this->name . '.' . ($item->Id ?? 'r' . random_int(1, PHP_INT_MAX)) . '.json';
|
||||
|
||||
if (!file_exists($name)) {
|
||||
file_put_contents($name, json_encode($item, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->notice(
|
||||
sprintf('Ignoring %s. No valid GUIDs.', $iName),
|
||||
(array)($item->ProviderIds ?? [])
|
||||
);
|
||||
|
||||
Data::increment($this->name, $type . '_ignored_no_supported_guid');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1169,6 +1169,14 @@ class PlexServer implements ServerInterface
|
||||
}
|
||||
|
||||
if (!$this->hasSupportedIds($item->Guid)) {
|
||||
if (true === Config::get('debug.import')) {
|
||||
$name = $this->name . '.' . ($item->ratingKey ?? 'r' . random_int(1, PHP_INT_MAX)) . '.json';
|
||||
|
||||
if (!file_exists($name)) {
|
||||
file_put_contents($name, json_encode($item, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->notice(sprintf('Ignoring %s. No valid GUIDs.', $iName), $item->Guid ?? []);
|
||||
Data::increment($this->name, $type . '_ignored_no_supported_guid');
|
||||
return;
|
||||
|
||||
@@ -260,7 +260,7 @@ if (!function_exists('saveRequestPayload')) {
|
||||
];
|
||||
|
||||
@file_put_contents(
|
||||
Config::get('tmpDir') . '/webhooks/' . sprintf(
|
||||
Config::get('tmpDir') . '/debug/' . sprintf(
|
||||
'request.%s.json',
|
||||
(string)ag($request->getServerParams(), 'X_REQUEST_ID', time())
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user