~mil/mepo

66cc9556c64051367060cf32cd26dba0585bc176 — Miles Alan a month ago 9ecaba7
Parameterize max concurrent transfers & download poll ms in config
2 files changed, 4 insertions(+), 2 deletions(-)

M src/TileCache.zig
M src/config.zig
M src/TileCache.zig => src/TileCache.zig +2 -2
@@ 185,13 185,13 @@ pub fn download_loop(tile_cache: *@This()) !void {
            msg = curl.curl_multi_info_read(tile_cache.curl_multi, &n_msgs);
        }

        while (tile_cache.queue_map.count() > 0 and tile_cache.n_current_transfers < 20) {
        while (tile_cache.queue_map.count() > 0 and tile_cache.n_current_transfers < config.MaxNTransfers) {
            var coords = tile_cache.queue_map.pop();
            try tile_cache.add_to_curl_multi(coords.key, coords.value);
            tile_cache.n_current_transfers += 1;
        }

        sdl.SDL_Delay(50);
        sdl.SDL_Delay(config.DownloaderPollMs);
    }
}


M src/config.zig => src/config.zig +2 -0
@@ 2,6 2,8 @@ pub const Tsize = 256;
pub const InitWindowW = 720;
pub const InitWindowH = 720;
pub const Useragent = "mepo";
pub const MaxNTransfers = 20;
pub const DownloaderPollMs = 50;

pub const DefaultBaseConfig =
    \\ bind_key _ j [move_relative 0 10];