There's not many of them, and there's a race condition where this script deletes
a dir at the same time the rails page cache wants to write a new file to it,
leading to 500s.
I can't take Rubocop any more. Moving up to Ruby 3 forces us to update RuboCop,
and it comes with dozens of linters that I'd have to evaluate, none of which is
a marginal improvement. I'm done having opinions.
Really embarassing bug in e334ae. This returned the current traffic intensity
number for all queries (0-100) so this started sending the mailing list mode
users basically every story and comment from the dawn of time.
TrafficHelper's hot-path intensity does a single select for a single row and
loads the value rather than instantiate an ActiveRecord object.
Updating the intensity has moved entirely to the cron job to prevent dogpiling,
and does three upserts instead of select + upsert.
No more hassling around with different keys for intensity when we only use the
latest value.
Environment should set the Rails env (and indeed our cron job does). If this
is present, running the spec alone fails because most devs don't configure a
'production' database on their local dev machines.
Caught by @AlessandroMinali
```
script/parse_inbound_mail:27:3: C: Style/StderrPuts: Use warn instead of STDERR.puts to allow such output to be disabled.
STDERR.puts "no active user with mailing list token #{parser.user_token}"
^^^^^^^^^^^
script/parse_inbound_mail:34:3: C: Style/StderrPuts: Use warn instead of STDERR.puts to allow such output to be disabled.
STDERR.puts "error parsing e-mail"
^^^^^^^^^^^
script/parse_inbound_mail:38:3: C: Style/StderrPuts: Use warn instead of STDERR.puts to allow such output to be disabled.
STDERR.puts "no valid comment or story being replied to"
^^^^^^^^^^^
script/parse_inbound_mail:42:3: C: Style/StderrPuts: Use warn instead of STDERR.puts to allow such output to be disabled.
STDERR.puts "no valid text/plain body found"
^^^^^^^^^^^
script/parse_inbound_mail:61:3: C: Style/StderrPuts: Use warn instead of STDERR.puts to allow such output to be disabled.
STDERR.puts c.errors.inspect
^^^^^^^^^^^
script/sync_twitter_users:29:3: C: Style/StderrPuts: Use warn instead of STDERR.puts to allow such output to be disabled.
STDERR.puts "need to implement paging for list members"
^^^^^^^^^^^
```
No parameters that need tuning and a single select for most hits.
Logo intensity is based on traffic in the last 15m compared to the last 90
days, and that calculation is cached for 5m. Deliberately does not use
transactions: we don't need the correctness, and it's cheaper to overwrite
a couple times than lock Keystore. Addresses #536; will know in a week if it
closes.
Now that we've had this in prod a while I've collected a few transient DNS
issues. Because webmentions are a nice-to-have, we can just drop the mention
if someone's DNS is flaking on us. We let BadIPsError hit logs because it
might be someone attempting to use this to enumerate our internal network
(tho it's most likely misconfiguration).
The story_cache for Story i9u0aw has a line with 72 spaces. Subtracting that
from the line length of 72, that's 0, so the gsub regexp becomes /(.{1,0})/
and throws an exception.