discourse/app/models/theme_svg_sprite.rb
Daniel Waterworth b7404373cf
FIX: Always clear caches after committing the current transaction (#22550)
Instead of having to remember every time, just always wait until the
current transaction (if it exists) has committed before clearing any
DistributedCache.

The only exception to this is caches that aren't caching things from
postgres.

This means we have to do the test setup after setting the test
transaction, because doing the test setup involves clearing caches.

Reapplying this - it now doesn't use after_commit if skip_db is set
2023-07-12 09:49:28 -05:00

27 lines
610 B
Ruby

# frozen_string_literal: true
class ThemeSvgSprite < ActiveRecord::Base
belongs_to :theme
def self.refetch!
ThemeField.svg_sprite_fields.find_each(&:upsert_svg_sprite!)
SvgSprite.expire_cache
end
end
# == Schema Information
#
# Table name: theme_svg_sprites
#
# id :bigint not null, primary key
# theme_id :integer not null
# upload_id :integer not null
# sprite :binary not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_theme_svg_sprites_on_theme_id (theme_id) UNIQUE
#