Skip to content

Commit 7dabc5a

Browse files
committed
fix: improve logging for async EPG fetch to clarify synchronous completion and error handling
1 parent c2aa240 commit 7dabc5a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/epg.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,20 @@ int epg_fetch_async(int epfd) {
211211

212212
logger(LOG_INFO, "Starting async EPG fetch from: %s", epg_cache.url);
213213

214-
/* Start async fetch with fd-based callback (zero-copy) */
214+
/* Start async fetch with fd-based callback (zero-copy)
215+
* Note: file:// URLs complete synchronously and return NULL (callback already
216+
* invoked) */
215217
fetch_ctx = http_fetch_start_async_fd(epg_cache.url, epg_fetch_fd_callback,
216218
NULL, epfd);
217-
if (!fetch_ctx) {
218-
logger(LOG_ERROR, "Failed to start async fetch for EPG");
219-
epg_cache.fetch_error_count++;
220-
return -1;
219+
220+
/* NULL return value can mean:
221+
* 1. file:// URL completed synchronously (callback already called) - SUCCESS
222+
* 2. Error occurred (callback called with error) - also handled
223+
* Non-NULL means HTTP(S) fetch started successfully and is in progress */
224+
if (fetch_ctx) {
225+
logger(LOG_DEBUG, "Async HTTP(S) fetch started, waiting for completion");
226+
} else {
227+
logger(LOG_DEBUG, "Fetch completed immediately (likely file:// URL)");
221228
}
222229

223230
return 0;

0 commit comments

Comments
 (0)