Reduce max_bytes_request_body
This commit is contained in:
parent
9695202cfe
commit
139c249497
4 changed files with 14 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -5,3 +5,4 @@ static/
|
||||||
.jetzig
|
.jetzig
|
||||||
src/app/database/data.db-journal
|
src/app/database/data.db-journal
|
||||||
src/app/database/old_migrations/
|
src/app/database/old_migrations/
|
||||||
|
src/lib/
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
run_step.dependOn(&run_cmd.step);
|
run_step.dependOn(&run_cmd.step);
|
||||||
|
|
||||||
const lib_unit_tests = b.addTest(.{
|
const lib_unit_tests = b.addTest(.{
|
||||||
.root_source_file = b.path("src/main.zig"),
|
.root_source_file = b.path("src/main.zig"),
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
@ -37,7 +37,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
|
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
|
||||||
|
|
||||||
const exe_unit_tests = b.addTest(.{
|
const exe_unit_tests = b.addTest(.{
|
||||||
.root_source_file = b.path("src/main.zig"),
|
.root_source_file = b.path("src/main.zig"),
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const jetzig = @import("jetzig");
|
const jetzig = @import("jetzig");
|
||||||
const jetquery = @import("jetzig").jetquery;
|
const jetquery = @import("jetzig").jetquery;
|
||||||
|
//const time = @cImport({
|
||||||
|
// @cInclude("time.h");
|
||||||
|
//});
|
||||||
|
|
||||||
// The `run` function for a job is invoked every time the job is processed by a queue worker
|
// The `run` function for a job is invoked every time the job is processed by a queue worker
|
||||||
// (or by the Jetzig server if the job is processed in-line).
|
// (or by the Jetzig server if the job is processed in-line).
|
||||||
|
|
@ -15,6 +18,8 @@ pub fn run(allocator: std.mem.Allocator, params: *jetzig.data.Value, env: jetzig
|
||||||
_ = allocator;
|
_ = allocator;
|
||||||
_ = params;
|
_ = params;
|
||||||
|
|
||||||
|
//const memory = try allocator.alloc(u8, 19);
|
||||||
|
|
||||||
// Get all scrobbles from the RawScrobbles table
|
// Get all scrobbles from the RawScrobbles table
|
||||||
|
|
||||||
const query = jetzig.database.Query(.RawScrobble).select(.{});
|
const query = jetzig.database.Query(.RawScrobble).select(.{});
|
||||||
|
|
@ -22,6 +27,10 @@ pub fn run(allocator: std.mem.Allocator, params: *jetzig.data.Value, env: jetzig
|
||||||
defer env.repo.free(scrobbles);
|
defer env.repo.free(scrobbles);
|
||||||
|
|
||||||
for (scrobbles) |scrobble| {
|
for (scrobbles) |scrobble| {
|
||||||
|
//const date = [19]u8{};
|
||||||
|
//time.strftime{ date, 19, "%Y-%m-%d %H:%M:%D", scrobbles.date };
|
||||||
|
//time.strftime(memory, 19, "%Y-%m-%d %H:%M:%S", scrobbles.date);
|
||||||
|
//std.debug.print("{s}", .{memory});
|
||||||
|
|
||||||
// Make hashes
|
// Make hashes
|
||||||
const album_hash = std.hash.Fnv1a_64.hash(scrobble.album);
|
const album_hash = std.hash.Fnv1a_64.hash(scrobble.album);
|
||||||
|
|
@ -70,7 +79,7 @@ pub fn run(allocator: std.mem.Allocator, params: *jetzig.data.Value, env: jetzig
|
||||||
if (song_check == 0) try env.repo.execute(song_insert);
|
if (song_check == 0) try env.repo.execute(song_insert);
|
||||||
|
|
||||||
const scrobble_offset = try jetzig.database.Query(.Scrobble).select(.{}).count().execute(env.repo) orelse unreachable;
|
const scrobble_offset = try jetzig.database.Query(.Scrobble).select(.{}).count().execute(env.repo) orelse unreachable;
|
||||||
try jetzig.database.Query(.Scrobble).insert(.{ .id = scrobble_offset + 1, .song_id = song_id, .album_id = album_id, .artist_id = artist_id }).execute(env.repo);
|
try jetzig.database.Query(.Scrobble).insert(.{ .id = scrobble_offset + 1, .song_id = song_id, .album_id = album_id, .artist_id = artist_id, .date = scrobble.date }).execute(env.repo);
|
||||||
}
|
}
|
||||||
// Clear RawScrobbles when done processing
|
// Clear RawScrobbles when done processing
|
||||||
try jetzig.database.Query(.RawScrobble).deleteAll().execute(env.repo);
|
try jetzig.database.Query(.RawScrobble).deleteAll().execute(env.repo);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ pub const jetzig_options = struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Maximum bytes to allow in request body.
|
// Maximum bytes to allow in request body.
|
||||||
pub const max_bytes_request_body: usize = std.math.pow(usize, 2, 32);
|
pub const max_bytes_request_body: usize = std.math.pow(usize, 2, 24);
|
||||||
|
|
||||||
// Maximum filesize for `public/` content.
|
// Maximum filesize for `public/` content.
|
||||||
// pub const max_bytes_public_content: usize = std.math.pow(usize, 2, 20);
|
// pub const max_bytes_public_content: usize = std.math.pow(usize, 2, 20);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue