Skip to content

Conversation

@janl
Copy link
Contributor

@janl janl commented May 11, 2018

Instead of hardcoding a list of spammer ids and names, we read them from the database.

This allows faster response times when we don’t have to wait for a full stage/prod deploy cycle.

The list of spammers is updated every minute, to reduce db load.

WIP because we still need to figure out how to bootstrap this cleanly, e.g. how to get the doc set up automatically.

@janl janl force-pushed the feat/dynamic-spam-list branch from 6a8ab9b to 24b0658 Compare May 11, 2018 13:16
const { gk } = dbs()
return gk.get('spam')
.then(spamDoc => spamDoc.spam)
.catch(() => {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 What do you think about returning an empty array when either the database connect did not work or the doc could not be found? That way, you don't interrupt the program for something that is not a critical error condition.

(Might be better to do it on the call side tho)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sorry for this drive by thing, after a week of staying in bed with a cold I just started to work off my inbox and this was on top :D)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or rather, make it so that if an error occurs, we don’t overwrite things in index.js, so at worst we block the old spammer list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants