add initialization logs

This commit is contained in:
Marcos Uchoa 2025-08-08 00:03:15 -03:00
parent 780ba9eeac
commit a822d01bd5
3 changed files with 8 additions and 2 deletions

View file

@ -26,7 +26,7 @@ pub var summary_exchange: exchange.PaymentSummaryExchange = undefined;
pub var server_settings: ServerSettings = .{};
pub fn init() !void {
const total_elements_expected = 100_000;
const total_elements_expected = 50_000;
const alloc_payments_repository = payments.calculateNecessaryMemory(total_elements_expected);
heap_alocated = try std.heap.page_allocator.alloc(u8, 1024 * 100 + alloc_payments_repository);

View file

@ -15,11 +15,14 @@ pub fn main() !void {
var post_endpoints = endpoints.EndpointsManager{};
var put_endpoints = endpoints.EndpointsManager{};
std.debug.print("Init context: OK\n", .{});
try ctx.init();
defer ctx.deinit();
std.debug.print("Context: OK\n", .{});
sec.updateToken(ctx.config.initial_token);
try endpoints.payments.registerEndpoints(&get_endpoints, &post_endpoints);
std.debug.print("Endpionts: OK\n", .{});
std.debug.print("default_pool: {d}\n", .{ctx.config.default_pool});
std.debug.print("fallback_pool: {d}\n", .{ctx.config.fallback_pool});
@ -38,6 +41,7 @@ pub fn main() !void {
try default_service.start();
try fallback_service.start();
try integrator.start();
std.debug.print("Service And Integrator: OK\n", .{});
ctx.payments_repository.subscribeInsert(&PaymentIntegrator.newPaymentEvent);
@ -49,9 +53,11 @@ pub fn main() !void {
std.log.info("Server Enviroment: {}\n", .{ctx.config.env});
var myserver = try server.HttpServer.init(ip_map, ctx.config.port, &get_endpoints, &post_endpoints, &put_endpoints);
std.debug.print("Init server: OK\n", .{});
std.Thread.sleep(1_000_000 * 1000 * 4);
try myserver.start();
std.debug.print("Server Started: OK\n", .{});
}
test {

View file

@ -43,7 +43,7 @@ pub const HttpServer = struct {
return HttpServer{
.address = address,
.address_options = net.Address.ListenOptions{ .kernel_backlog = 256 },
.address_options = net.Address.ListenOptions{},
.get_endpoints = get_endpoints,
.post_endpoints = post_endpoints,
.put_endpoints = put_endpoints,