[Step 3] Update snippet stats in PostReceive worker
After a git operation is performed over a snippet, we expire the project statistics. Right after, we need to call the
snippet.statistics.refresh! in order to update all the data we need from the repository.
This will be also the place where we will create the statistics relation if it doesn't exist. Something like:
stats = snippet.statistics || snippet.build_statistics stats.refresh!
We also need to update the projects global statistics to include the new value. It has to be after we execute
stats.refresh!. For this, we need to call
ProjectCacheWorker.perform_async(snippet.project.id, , [:snippets_size]). It's important that we only call this worker if the snippet is a project one.