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

WIP: dynamic spam list #757

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

WIP: dynamic spam list #757

wants to merge 1 commit into from

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.

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.

None yet

2 participants