Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: when the indexer hasn't finished some pages show an error #61

Open
plexus opened this issue Sep 13, 2019 · 0 comments
Open

Problem: when the indexer hasn't finished some pages show an error #61

plexus opened this issue Sep 13, 2019 · 0 comments

Comments

@plexus
Copy link
Member

plexus commented Sep 13, 2019

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.

(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

(defonce !indexes (atom {:chan-name->id {} ,,,}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant