clj-commons / durable-queue

a disk-backed queue for clojure
Eclipse Public License 1.0
384 stars 31 forks source link

Permissions Issues on /tmp/* Directories #13

Open drbobbeaty opened 7 years ago

drbobbeaty commented 7 years ago

I've noticed an annoying issue that seems like it might be avoidable.

Let's say that I'm using durable-queue in a project:

(defonce q (queues "/tmp" {}))

and then you're off and having fun and it's working great, and your MacBook Pro connects to some WiFi hotspot at home - or work, and macOS creates a bunch of temp files:

/tmp/wifi-01-25-2017_12:34:56.log

and when the code starts, there are permission issues on these files, and the code exceptions. When I delete these log files, everything is fine.

My question is - can these files in /tmp that aren't durable queue data files - be excluded from the search on startup?

drbobbeaty commented 7 years ago

Guys, I've been looking at the code for durable-queue namespace, and if you change line 401 from:

                      (filter #(re-find #"\w+_\d+" (.getName ^File %)))

to:

                      (filter #(re-find #"\w+_\d+$" (.getName ^File %)))

then the problem will disappear. To be complete, you could also change line 402 from:

                      (group-by #(second (re-find #"(\w+)_\d+" (.getName ^File %)))))]

to:

                      (group-by #(second (re-find #"(\w+)_\d+$" (.getName ^File %)))))]

and then we're good.

Can you look to make that change, or should I create a PR for this?

drbobbeaty commented 7 years ago

I ended up making this a PR - while bumping the version to 0.1.6.

vedang commented 1 year ago

It's safe to close this issue as it has been fixed in e59d0074360b10141f014753a9d1004c160c04ba (as mentioned in the last comment above)