clojureverse / clojureverse/clojurians-log-app
Problem: when the indexer hasn't finished some pages show an error
- Dominant language
- Clojure
- Stars
- 85
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
Some slow queries we only do once an hour by a component known as the "indexer", it puts a bunch of lookup maps in an atom.
When the app starts it takes a few minutes before this index map is populated, at that point we should show empty pages or some kind of "sit tight" page, but not a 500 error (NullPointerException) as we do now.
In this code chan-name->id is supposed to be a map, but it can also be `nil`.
``` clojure
(defn channel-days [db chan-name]
(let [{:keys [chan-day-cnt chan-name->id]} @!indexes]
(some->> chan-name
chan-name->id
chan-day-cnt
(sort-by first reverse-compare))))
```
The solution can be as simple as putting some placeholder maps in `!indexes`
``` clojure
(defonce !indexes (atom {:chan-name->id {} ,,,}))
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Find the channel-days function and the !indexes definition described in the issue, then trace how the indexer populates the lookup maps. Ensure the unpopulated index state produces empty pages or a waiting state instead of a NullPointerException, and verify the affected page behavior during startup.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100