<commit_before>class CommentSweeper  < ActionController::Caching::Sweeper
  observe Comment, Identification
  include Shared::SweepersModule
  
  def after_save(item)
    obs = item.is_a?(Comment) ? item.parent : item.observation
    expire_observation_components(obs) if obs.is_a?(Observation)
  end
  
  def after_destroy(item)
    obs = item.is_a?(Comment) ? item.parent : item.observation
    expire_observation_components(obs) if obs.is_a?(Observation)
  end
end<commit_msg>Listed taxon comments expire the lt frag cache.<commit_after>class CommentSweeper  < ActionController::Caching::Sweeper
  observe Comment, Identification
  include Shared::SweepersModule
  
  def after_save(item)
    sweep_comment(item)
    true
  end
  
  def after_destroy(item)
    sweep_comment(item)
    true
  end
  
  def sweep_comment(item)
    if item.is_a?(Comment)
      expire_listed_taxon(item.parent) if item.parent.is_a?(ListedTaxon)
      expire_observation_components(item.parent) if item.parent.is_a?(Observation)
    else
      expire_observation_components(item.observation)
    end
  end
end
{'fraction_non_alphanumeric': 0.08249312557286893, 'fraction_numerical': 0.0, 'mean_word_length': 4.46, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '899363', 'n_tokens_mistral': 364, 'n_tokens_neox': 368, 'n_words': 68}