non-zero exit when appropriate
All checks were successful
Generic zig build / build (push) Successful in 1m20s
Generic zig build / deploy (push) Successful in 15s

This commit is contained in:
Emil Lerch 2026-03-24 19:01:25 -07:00
parent 6a46606f83
commit ea7f07e6c1
Signed by: lobo
GPG key ID: A7B62D657EF764F8
2 changed files with 14 additions and 4 deletions

View file

@ -14,8 +14,8 @@
.hash = "httpz-0.0.0-PNVzrBtMBwAPcQx3mNEgat3Xbsynw-eIC9SmOX5M9XtP", .hash = "httpz-0.0.0-PNVzrBtMBwAPcQx3mNEgat3Xbsynw-eIC9SmOX5M9XtP",
}, },
.zfin = .{ .zfin = .{
.url = "git+https://git.lerch.org/lobo/zfin#5052492ffd49ebdc11b209da1b86bbaf7d365e5e", .url = "git+https://git.lerch.org/lobo/zfin#ecadfb492d8730c3226c738b6cb63e688d7f89dc",
.hash = "zfin-0.0.0-J-B21ryaDACsjkyET8s_NhF0W745-Qoc_fj9VM8Z-Ngx", .hash = "zfin-0.0.0-J-B21tqwDACaht3HgLXCYDXJsyZsMwzncEKeX2JYiiJG",
}, },
}, },
} }

View file

@ -175,8 +175,8 @@ fn handleReturns(app: *App, req: *httpz.Request, res: *httpz.Response) !void {
const vol_term: ?u8 = if (v10y != null) 10 else if (v5y != null) 5 else if (v3y != null) 3 else if (v1y != null) 1 else null; const vol_term: ?u8 = if (v10y != null) 10 else if (v5y != null) 5 else if (v3y != null) 3 else if (v1y != null) 1 else null;
// Total returns: adj_close is the primary source (accounts for splits + dividends). // Total returns: adj_close is the primary source (accounts for splits + dividends).
// Dividend-reinvestment is only used as fallback when adj_close returns null // Dividend-reinvestment only fills gaps where adj_close returns null
// (e.g. candle history too short for stable-NAV funds like money markets). // (e.g. stable-NAV funds with short candle history).
var t1y: ?f64 = p1y; var t1y: ?f64 = p1y;
var t3y: ?f64 = p3y; var t3y: ?f64 = p3y;
var t5y: ?f64 = p5y; var t5y: ?f64 = p5y;
@ -485,6 +485,14 @@ fn refresh(allocator: std.mem.Allocator) !void {
} else |err| { } else |err| {
try stdout.print("candles FAILED ({s})", .{@errorName(err)}); try stdout.print("candles FAILED ({s})", .{@errorName(err)});
sym_ok = false; sym_ok = false;
if (err == zfin.DataError.TransientError or err == zfin.DataError.AuthError) {
const reason = if (err == zfin.DataError.AuthError) "auth failure" else "transient provider failure";
try stdout.print("\n", .{});
try stdout.print("\nStopping refresh: {s}\n", .{reason});
try stdout.print("Refresh aborted: {d} ok, {d} failed\n", .{ success_count, fail_count + 1 });
try stdout.flush();
return error.RefreshFailed;
}
} }
// Dividends // Dividends
@ -515,6 +523,8 @@ fn refresh(allocator: std.mem.Allocator) !void {
try stdout.print("\nRefresh complete: {d} ok, {d} failed\n", .{ success_count, fail_count }); try stdout.print("\nRefresh complete: {d} ok, {d} failed\n", .{ success_count, fail_count });
try stdout.flush(); try stdout.flush();
if (fail_count > 0) return error.RefreshFailed;
} }
// Main // Main