-
Notifications
You must be signed in to change notification settings - Fork 18
jobs unhack #112
Comments
wouldn't this use a lot of file descriptors if we install an insane amount of plugins in parallel? Not that this would be an issue, as there aren't so many plugins, as usually available file descriptors but still... I don't think that the current implementation is particularly ugly or hacky. It's a bit verbose, though. The only thing that is really bothering me (although I haven't looked into it yet) is why I need to multiply the number of processes by 5 in the case of If this trickery could be moved into a function of some sort, I would not mind this change of algorithm. But it's a bit cryptic to me 😅 |
Just to be clear, I'm not proposing that you change anything in
Are you referring to the In
That, and your comment I've been thinking about a better architecture for a while. In I dunno, I just thought you might be interested. |
Yes, jobs are writing log files, but that's what we have to do, so that's not an issue. What I'm saying is that in the case of the current implementation, we only create 1 additional file for jobs, and write active jobs to it. In the case of your code, if I understand it correctly, each job opens a file descriptor for a
Yeah, I mean it's hackier than just calling
I believe there are tons of scripts that rely on this, so it should not be an issue. I mean, if someone renames kak or moves it out from the Ideally I would like to move away from creating too much files, but I see it as a low priority for now. |
No holding on to fd's (other than the log fd) in my trick. The file is created before the sub-subshell starts, and removed after the sub-subshell finishes. All in
I know. Practically speaking, it's true, but it seems misguided. I have a couple of Given the widespread usage,
You're only creating one |
Not an issue, just some ideas here. While working on my copy of
kak-bundle
, I've come up with another approach to keeping track of jobs and avoiding complicated hacks.The trick is to communicate via the filesystem (code from
vvc()
in that repo):For each job, you create a
.running
file in a tmpdir, and when the job ("$@"
) sub-subshell exits, the subshell removes it. With this, there's no need towait()
, or to count processes. You can simply count the number of*.running
glob matchesWhen all jobs are done,
$running = 0
.The text was updated successfully, but these errors were encountered: