Add additional logging
This commit is contained in:
parent
9585ce7f9e
commit
8a0aa0b949
1 changed files with 4 additions and 0 deletions
|
@ -57,6 +57,7 @@ fn fetchThread(state: *AppState) !void {
|
|||
continue;
|
||||
};
|
||||
defer parsed.deinit();
|
||||
std.debug.print("[home/fetchThread] Parsed data\n", .{});
|
||||
|
||||
var results = std.ArrayList(AppState.HSSuggestion).init(allocator);
|
||||
for (parsed.value) |station| {
|
||||
|
@ -72,9 +73,11 @@ fn fetchThread(state: *AppState) !void {
|
|||
}
|
||||
}
|
||||
}
|
||||
std.debug.print("[home/fetchThread] Created results: {} stations\n", .{results.items.len});
|
||||
state.home_screen_state.mutex.lock();
|
||||
defer state.home_screen_state.mutex.unlock();
|
||||
if (state.home_screen_state.suggestions.len > 0) {
|
||||
std.debug.print("[home/fetchThread] Deallocating previous data\n", .{});
|
||||
for (state.home_screen_state.suggestions) |suggestion| {
|
||||
allocator.free(suggestion.id);
|
||||
allocator.free(suggestion.name);
|
||||
|
@ -82,6 +85,7 @@ fn fetchThread(state: *AppState) !void {
|
|||
allocator.free(state.home_screen_state.suggestions);
|
||||
}
|
||||
state.home_screen_state.suggestions = results.toOwnedSlice() catch continue;
|
||||
std.debug.print("[home/fetchThread] Replaced suggestions\n", .{});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue