Stale Cache

If the binning page shows a legend that has too many boxes, or the stats on for gc or coverage or sequence length are missing, the cache is likley stale.

Fix with this…

p = Project.find 'slug'
p.contigs.select("id").find_in_batches do |batch|
 BatchTaxonomyStats.perform_async("update", batch.first.id, batch.last.id, "scope_type" => "Project", "scope_id" => p.id)
end

# when sidekiq jobs are done…

p.invalidate_cached_contigs

## note this could also be done for individual organisms

# NOTE: Occasionally this doesn’t fix the problem and running for the organism specifically is required!  Remember to change “scope_type” on the BatchTaxonomyStats line

o.contigs.select("id").find_in_batches do |batch|
 BatchTaxonomyStats.perform_async("update", batch.first.id, batch.last.id, "scope_type" => "Organism", "scope_id" => o.id)
end
o.invalidate_cached_contigs