const ThreadPool = @import("bun").ThreadPool; const std = @import("std"); pub const Batch = ThreadPool.Batch; pub const Task = ThreadPool.Task; pub fn NewWorkPool(comptime max_threads: ?usize) type { return struct { var pool: ThreadPool = undefined; var loaded: bool = false; fn create() *ThreadPool { @setCold(true); pool = ThreadPool.init(.{ .max_threads = max_threads orelse @floatToInt(u32, @floor(@intToFloat(f32, @max(std.Thread.getCpuCount() catch 0, 2)) * 0.8)), .stack_size = 2 * 1024 * 1024, }); return &pool; } pub inline fn get() *ThreadPool { // lil racy if (loaded) return &pool; loaded = true; return create(); } pub fn scheduleBatch(batch: ThreadPool.Batch) void { get().schedule(batch); } pub fn schedule(task: *ThreadPool.Task) void { get().schedule(ThreadPool.Batch.from(task)); } pub fn go(allocator: std.mem.Allocator, comptime Context: type, context: Context, comptime function: fn (Context) void) !void { const TaskType = struct { task: Task, context: Context, allocator: std.mem.Allocator, pub fn callback(task: *Task) void { var this_task = @fieldParentPtr(@This(), "task", task); function(this_task.context); this_task.allocator.destroy(this_task); } }; var task_ = try allocator.create(TaskType); task_.* = .{ .task = .{ .callback = TaskType.callback }, .context = context, .allocator = allocator, }; schedule(&task_.task); } }; } pub const WorkPool = NewWorkPool(null); on> Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/.eslintrc.cjs (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2023-07-14[ci] release (#7658)Gravatar Houston (Bot) 8-14/+16
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-14[ci] formatGravatar natemoo-re 2-4/+4
2023-07-14fix(#7654): exclude @vercel/nft (#7659)Gravatar Nate Moore 3-0/+11
2023-07-14[ci] formatGravatar natemoo-re 2-26/+28
2023-07-14Sitemap should only exclude 404 and 500 pages (#7655)Gravatar Nate Moore 7-29/+60
* fix(#7472): sitemap should only exclude 404 and 500 pages * chore: refactor logic, add test
2023-07-14Revert "Clarify SSR limitations of sitemaps of dynamic routes (#7625)" (#7653)Gravatar Matthew Phillips 1-2/+0
This reverts commit 9352ac65f4d8c44a5d0cf9cccc37a1196da538cf.
2023-07-14[ci] formatGravatar ematipico 1-3/+2
2023-07-14refactor: use SSR manifest in dev (#7587)Gravatar Emanuele Stoppa 8-97/+182
2023-07-14[ci] formatGravatar matthewp 1-2/+1
2023-07-14Clarify SSR limitations of sitemaps of dynamic routes (#7625)Gravatar paulrudy 1-0/+3
While this README doesn't distinguish between SSR mode and static mode (and SSR mode was recently made available for the sitemaps integration), there is one important difference: Dynamic routes that are server-rendered can't be used to create sitemap entries. This note makes that clear.
2023-07-14[ci] release (#7645)astro@2.8.3Gravatar Houston (Bot) 44-85/+77
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-14nit: export props has been unnecessary.. forever (#7646)Gravatar Erika 32-39/+39
2023-07-14fix(squoosh): Fix wrong file path in rotation check (#7650)Gravatar Erika 1-1/+3
2023-07-14[docs] fix link in image integration README (#7649)Gravatar Sarah Rainsberger 1-1/+1
2023-07-14Remove weird changeset symbols (#7648)Gravatar Bjorn Lu 2-2/+2
2023-07-14Refactor merge server config (#7639)Gravatar Bjorn Lu 3-28/+26
2023-07-13[ci] formatGravatar matthewp 4-16/+19
2023-07-13Fixes for redirects config (#7644)Gravatar Matthew Phillips 9-14/+110
* Update redirects static generation based on recs Got some great recommendations on how to handle our HTML written redirect code based on SEO best practices. See https://github.com/withastro/roadmap/issues/466#issuecomment-1595940678 This implements them all. * Fix for using the root path / as a redirect Fixes https://github.com/withastro/astro/issues/7478 * Fix static redirects prefer over dynamic page Fixes https://github.com/withastro/astro/issues/7581
2023-07-13fix(assets): Fix images not following EXIF rotation (#7637)Gravatar Erika 7-8/+46
2023-07-13[ci] formatGravatar Princesseuh 1-1/+1
2023-07-13Allow SVGs when using Assets (#7643)Gravatar Alvin Bryan 8-17/+46
* Allow SVG files when using Assets * Fixed TypeScript error * fix: some small nits and add a test * chore: changeset --------- Co-authored-by: Princesseuh <princssdev@gmail.com>
2023-07-13Convert CLI top-level imports as dynamic imports (#7635)Gravatar Bjorn Lu 4-46/+45
2023-07-13[ci] release (#7624)astro@2.8.2@astrojs/vercel@3.7.1@astrojs/underscore-redirects@0.2.0@astrojs/netlify@2.4.0@astrojs/cloudflare@6.6.1Gravatar Houston (Bot) 49-108/+129
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-13[ci] formatGravatar sarah11918 1-5/+10
2023-07-13[docs] update image integration README (#7633)Gravatar Sarah Rainsberger 1-2/+69
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
2023-07-13[ci] formatGravatar bluwy 1-1/+1
2023-07-13Move all CLI commands to their subfolders (#7634)Gravatar Bjorn Lu 7-102/+170
2023-07-13[ci] formatGravatar ematipico 1-2/+2
2023-07-13feat(@astrojs/netlify): add `build.split` support (#7615)Gravatar Emanuele Stoppa 20-35/+234
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-07-13Update turbo cache flow (#7631)Gravatar Bjorn Lu 1-33/+36
2023-07-12Fix `build.excludeMiddleware` default type docs (#7630)Gravatar Yan Thomas 1-1/+1
2023-07-12Refactor config loading (#7622)Gravatar Bjorn Lu 6-151/+90
2023-07-12[ci] formatGravatar bluwy 1-1/+1
2023-07-12feat: bumped typescript-eslint to v6 stable 🥳 (#7626)Gravatar Josh Goldberg ✨ 4-43/+49
2023-07-12fix(@astrojs/vercel): improve file detection (#7621)Gravatar Emanuele Stoppa 16-25/+113
2023-07-11[ci] formatGravatar matthewp 1-1/+1
2023-07-11Fixes Response not being cloneable by middleware (#7623)Gravatar Matthew Phillips 5-0/+37
2023-07-11[ci] release (#7594)astro@2.8.1@astrojs/prefetch@0.3.0@astrojs/markdoc@0.4.2Gravatar Houston (Bot) 50-104/+100
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-11Filter out astro from `peerDependencies` in `astro add` (#7620)Gravatar Chris Swithinbank 2-1/+7
2023-07-11[ci] formatGravatar bluwy 1-1/+1
2023-07-11Refactor simple CLI commands (#7619)Gravatar Bjorn Lu 12-115/+123
2023-07-10fix: `astro info` command fallback for package manager (#7618)Gravatar Emanuele Stoppa 2-1/+7
2023-07-10Add CLI startup speed benchmark (#7617)Gravatar Bjorn Lu 5-11/+95
2023-07-10[ci] formatGravatar bluwy 1-1/+1