where-the-fuck-is-the-/wdg/-thread? edition
i was looking for this thread to ask a questioni don't program javascript often, so help me out herei'm writing a cpu intensive program using a webworker to run the compute and the main thread to draw the result as it comesit appears that the worker is posting messages faster than the main thread can consume them causing the message queue to grow without bound (classic production-consumer message queue problem)does the web worker api have any settings to wait on the message queue if it gets too large, or do i have to implement that shit myself with something like a handshake?i've locked up my computer once today, and don't feel like putting it through that shit again, cause now i have to go through 9000 captchas before i get back to the nice and cozy easy 2 i was at
>>108409537I have not used Web Workers myself
>>108409507hello I am here for the Gemini capsule brohurry and invite me before I start gooning. You do NOT want my slunk making a mess in there
>>108409537did you write this post with gemini?
>>108412057no. fuck ai, and fuck you
>>108412143because gemini loves to say something is a "classic X problem". Maybe it's filtering out into the speech pattern of people now
>>108412258i kept trying to use those terms to search because web workers use message passing to communicate and that's the correct set of keywords that describe the issue, but search keeps returning bullshitthere's no guarantee whether the consumer or producer is the one that can't keep up, so i need the message queue to let the consumer/main thread sleep when the queue is empty or the producer/worker to sleep if the queue is fulli know how to solve it with mutexes and condition variables in C, but something tells me that's not going to happen in javascripta little more detail, i'm trying to write an web-based emulator for a tile-based gpu i developed. i have the gpu emulation running in a worker, and need to push pixels to a canvas. it seems there is an OffscreenCanvas API that might be the way to go. i'll look into it tomorrow. any suggestions are welcome.
>>108412287there's also this if you want to build a mutexhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/waitAsync
>>108412287ok, i decided to stay up late and used the OffscreenCanvas API and it works.no more blown queues because all the work is being done in the worker and no messages have to be passed back to the main thread to render to the DOMnext question is this: what is the fastest way to loop the execution in my worker thread such that the canvas updates?when i simply use a while(1) { run(); } loop, the canvas fails to updatei can use setInterval(run, 1), and while that works, it's slower than i want and seems to be frowned upononce again, any suggestions? can i add some sort of function call to the while loop after run() that will do whatever the fuck has to happen to get the canvas to update?
btw, i'm only drawing a single pixel each loopwhile this is desirable from a cycle-accurate emulation perspective, it's reasonable to expect that i'll have to batch render e.g. a scanline at a time to get any measure of performancereal-time rendering of 60 frames a second isn't a goal hereas it stands, it takes about 70 seconds to render a 128x128 pixel display on my desktop, and could take up to x4 longer tor more to cycle through the 256x256 pixel display cycle
last thing i'll ask tonight: anyone know of any good javascript hex editor widgets? i need a way to edit several different memories and expose the underlying byte arrays to the emulated gpu. a simple hex editor that lets me load up a default binary file would be ideal.
>>108411714I barely post in here though>>108412057https://geminiprotocol.net/
>>108409507>on the internet nobody knows that you're a cat
>>108409537I would guess this is could be something async/await would solve but take it with a grain of salt since I don't understine in fine detail what ur doing, conrinuing with the assumprion, it would make the thing slower, since it would wait for instructions one after the other, there's also some kind of await group if ur awaiting instructions in group, it will wait for all of them without the order mattering this might come in hand at some point to optimizeping us in the thread if this helped cause it's an interesting case
Some twat has been spamming my VPS with login attempts. I guess I need to harden my fail2ban settings
>>108413013I wonder if SHA key (first) to login (second) wouldn't defeat this problem at once
>>108413162I can't say I know what an SHA key is. I use an SSH key to log in to my VPS. I installed fail2ban and I thought the settings I added would ban IP addresses who repeatedly submit incorrect login attempts. I think I need to change my fail2ban settings though, I've tried a couple of things but I haven't explicitly defined a `banaction` so maybe that's why I keep seeing login attempts from the same IP address.
>>108413293>I use an SSH key to log in to my VPSthat's probs a sha keyanone here knows, does it make sense to restrict login with an sha key, would it solve anything?
>>108413300I dunno. Anyway I think I've solved the problem now by adding `banaction = ufw` to the file /etc/fail2ban/jail.local. Now when fail2ban wants to ban an IP address, it sets a ufw rule to block incoming connections from that IP address. While the IP address is banned I don't see any more login attempts from it in my sshd logs, because ufw blocks those attempts before they reach sshd. So now the bastard who was hammering my VPS with login attempts can't do anything. I guess it's good that I found this issue before someone managed to brute force their way into my VPS.
Am I retarded if I write a web application in PHP without the use of any frameworks?