<commit_before># frozen_string_literal: true

class Web::PushNotificationWorker
  include Sidekiq::Worker

  sidekiq_options backtrace: true

  def perform(subscription_id, notification_id)
    subscription = ::Web::PushSubscription.find(subscription_id)
    notification = Notification.find(notification_id)

    subscription.push(notification) unless notification.activity.nil?
  rescue Webpush::ResponseError => e
    subscription.destroy! if (400..499).cover?(e.response.code.to_i)<commit_msg>Change the retry limit in error of web push notification (#11292)<commit_after># frozen_string_literal: true

class Web::PushNotificationWorker
  include Sidekiq::Worker

  sidekiq_options backtrace: true, retry: 5

  def perform(subscription_id, notification_id)
    subscription = ::Web::PushSubscription.find(subscription_id)
    notification = Notification.find(notification_id)

    subscription.push(notification) unless notification.activity.nil?
  rescue Webpush::ResponseError => e
    subscription.destroy! if (400..499).cover?(e.response.code.to_i)
{'fraction_non_alphanumeric': 0.09564393939393939, 'fraction_numerical': 0.017045454545454544, 'mean_word_length': 6.093959731543624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2755586', 'n_tokens_mistral': 305, 'n_tokens_neox': 297, 'n_words': 63}