Skip to content

Write console command to re-calculate counter aggregate value #71

@antonkomarev

Description

@antonkomarev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions