Skip to content

Commit fd77b6a

Browse files
committed
Fixed outdated GPU metadata caching
fixes #247
1 parent 1e28057 commit fd77b6a

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99
- Support to autodetect eGPUs (Issue #182)
1010

1111
### Fixed
12+
- Outdated GPU metadata caching issues (Issue #247)
1213
- Old libary installation files would cause identification problems (Issue #241)
1314

1415
## [1.19.1] - 2024-06-26

TinyNvidiaUpdateChecker/Handlers/MetadataHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class MetadataHandler
2222
/// </summary>
2323
static OSClassRoot cachedOSData;
2424

25-
public static void PrepareCache()
25+
public static void PrepareCache(bool forceRecache = false)
2626
{
27-
var gpuData = GetCachedMetadata("gpu-data.json", false);
28-
var osData = GetCachedMetadata("os-data.json", false);
27+
var gpuData = GetCachedMetadata("gpu-data.json", forceRecache);
28+
var osData = GetCachedMetadata("os-data.json", forceRecache);
2929

3030
// Validate GPU Data JSON
3131
try {

TinyNvidiaUpdateChecker/MainConsole.cs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ private static void CheckArgs(string[] args)
397397
/// <summary>
398398
/// Finds the GPU, the version and queries up to date information
399399
/// </summary>
400-
///
401-
private static (GPU, int) GetDriverMetadata()
400+
401+
private static (GPU, int) GetDriverMetadata(bool forceRecache = false)
402402
{
403403
bool isNotebook = false;
404404
bool isDchDriver = false; // TODO rewrite for each GPU
@@ -550,17 +550,25 @@ private static (GPU, int) GetDriverMetadata()
550550
}
551551
}
552552

553-
Write("ERROR!");
554-
WriteLine();
555-
WriteLine("GPU metadata for your card does not exist, or could not be validated! Please file an issue on the GitHub project page and include the following information:");
556-
WriteLine();
553+
// If no GPU could be validated, then force recache once, and loop again.
554+
// This fixes issues related with outdated cache
555+
if (!forceRecache) {
556+
MetadataHandler.PrepareCache(true);
557+
return GetDriverMetadata(true);
558+
} else {
559+
Write("ERROR!");
560+
WriteLine();
561+
WriteLine("GPU metadata lookup has failed! Please file an issue on the GitHub project page and include the following information:");
562+
WriteLine();
557563

558-
foreach (GPU gpu in gpuList) {
559-
WriteLine($"GPU Name: '{gpu.name}' | VendorId: {gpu.vendorId} | DeviceId: {gpu.deviceId} | IsNotebook: {gpu.isNotebook}");
560-
}
564+
foreach (GPU gpu in gpuList)
565+
{
566+
WriteLine($"GPU Name: '{gpu.name}' | VendorId: {gpu.vendorId} | DeviceId: {gpu.deviceId} | IsNotebook: {gpu.isNotebook}");
567+
}
561568

562-
callExit(1);
563-
return (null, 0);
569+
callExit(1);
570+
return (null, 0);
571+
}
564572
}
565573

566574
private static JObject GetDriverDownloadInfo(int gpuId, int osId, bool isDchDriver) {

0 commit comments

Comments
 (0)