Skip to content

Commit 6e816fc

Browse files
committed
CPUUsage: don't hang on weird host
Try fixing CI of FreeBSD
1 parent 5a699af commit 6e816fc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/detection/cpuusage/cpuusage.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const char* ffGetCpuUsageResult(FFlist* result)
2727
if(cpuTimes1.length == 0) return "No CPU cores found";
2828

2929
FF_LIST_AUTO_DESTROY cpuTimes2 = ffListCreate(sizeof(FFCpuUsageInfo));
30+
uint32_t retryCount = 0;
3031

3132
retry:
3233
error = ffGetCpuUsageInfo(&cpuTimes2);
@@ -41,6 +42,8 @@ const char* ffGetCpuUsageResult(FFlist* result)
4142
{
4243
ffListClear(&cpuTimes2);
4344
ffTimeSleep(200);
45+
if (++retryCount >= 10)
46+
return "Retry count exceeded";
4447
goto retry;
4548
}
4649
}

0 commit comments

Comments
 (0)