wincent / masochist

⛓ Website infrastructure for over-engineers
MIT License
78 stars 26 forks source link

When tag count drops to zero, should remove or suppress #37

Closed wincent closed 8 years ago

wincent commented 8 years ago

I just changed a couple of "memcache" tags to "memcached", causing the count for "memcache" to drop to zero.

It is, however, still showing up in the index at https://wincent.com/tags

Worse still, the articles show up at: https://wincent.com/tags/memcache

On the bright side, when you navigate to the actual articles, they do at least show the "memcached" tag and not "memcache".

ryanblakeley commented 7 years ago

@wincent I copied this repo and cleared out all but a few content examples. The /tags page still shows all the tags with a count of 0. It looks like wincent.com has that same behavior.

Were you thinking of a way to prevent rendering tags with 0 count? Or is there a "hard reset" path for getting these tags out of the way?

wincent commented 7 years ago

I'm on my phone right now so can't confirm the actual details, but from memory you should be able to rebuild the Redis indices to get correct tag counts.

The update script is: https://github.com/wincent/masochist/blob/master/app/src/bin/updateIndices.js

The cache key for memcached is in: https://github.com/wincent/masochist/blob/master/app/src/common/Cache.js

The cache key for Redis is in: https://github.com/wincent/masochist/blob/master/shared/common.json

But yes, something should be done to make renaming tags easier without having to manually regen indices.

ryanblakeley commented 7 years ago

Thanks for the quick response. I flushed both caches and ran the update script, but I'm still seeing the zeros. Is it possible that the git history is affecting things? I was thinking about squashing the git history so those tags never exist.

Edit: I tried to flush both caches. I haven't used Redis or Memcache so I'm not sure how successful I was. I ran redis-cli and FLUSHALL, then telnet localhost 11211 and flush_all.

ryanblakeley commented 7 years ago

As mentioned in your notes, bumping the version numbers to manually invalidate the cache is what works. Thanks

wincent commented 7 years ago

Thanks for reporting back in. I'll make a separate issue for improving the ergonomics for this use case.