After fix (by @Brikaa) of counter reset because of the race condition (#66) we need to create console command which will re-calculate correct counter values. It should count lines in storage/{username}-views file and store them to storage/{username}-views-count.
Something like:
cat storage/{username}-views | wc -l | tr -d ' ' > storage/{username}-views-count
But we should iterate thru all the usernames in the storage directory. There are many counter files, so ls -la is hanging for a long time.
One more thing to ensure: we need to make -1 from wc -l, because of the empty line at the end of file.
After fix (by @Brikaa) of counter reset because of the race condition (#66) we need to create console command which will re-calculate correct counter values. It should count lines in
storage/{username}-viewsfile and store them tostorage/{username}-views-count.Something like:
cat storage/{username}-views | wc -l | tr -d ' ' > storage/{username}-views-countBut we should iterate thru all the usernames in the storage directory. There are many counter files, so
ls -lais hanging for a long time.One more thing to ensure: we need to make
-1fromwc -l, because of the empty line at the end of file.