filed
Job queue using FUSE
git clone git://mccd.space/filed
| Log | Files | Refs | README | LICENSE |
commit d9ff9f5cc67e55ffa1a3d9dca0da4433926b2aa7 parent 33f7c4c35b6b1823e7074404378684d907cb057f Author: Marc Coquand <marc@coquand.email> Date: Wed, 17 Dec 2025 12:16:55 +0100 Simplify killing process Diffstat:
| M | README.md | | | 2 | +- |
| M | jobdir.go | | | 13 | ++++--------- |
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
@@ -95,7 +95,7 @@ I was inspired by 9p, and files proved to be a great abstraction since directori
- [ ] Package for Alpine Linux (with reusable openrc script)
- [ ] Add support for removing/moving active jobs
- [ ] When moved to failed, the job should be killed immediately
- - [ ] When removed, the job should be killed immediately
+ - [x] When removed, the job should be killed immediately
## Status
diff --git a/jobdir.go b/jobdir.go
@@ -73,21 +73,16 @@ func (jd JobDir) ReadDirAll(ctx context.Context) (entries []fuse.Dirent, err err
func (jd JobDir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
slog.Info("Removing job", "id", req.Name)
- job, err := jd.manager.store.GetJob(req.Name)
- if err != nil {
- slog.Error("Could not get job")
- return syscall.EIO
- }
- if job.State == store.StateRunning {
- val, ok := jd.manager.activeJobs.Load(job.ID)
+ if jd.state == store.StateRunning {
+ val, ok := jd.manager.activeJobs.Load(req.Name)
if !ok {
// Assume that job is already complete
- return jd.manager.store.DeleteJob(job.ID)
+ return jd.manager.store.DeleteJob(req.Name)
}
activeJob := val.(*ActiveJob)
activeJob.cancel()
}
- return jd.manager.store.DeleteJob(job.ID)
+ return jd.manager.store.DeleteJob(req.Name)
}
func (d JobDir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fs.Node) error {