source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_new_user_compliance_info_worker.rb
Ruby
mit
8,966
main
351
# frozen_string_literal: true class HandleNewUserComplianceInfoWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(user_compliance_info_id) user_compliance_info = UserComplianceInfo.find(user_compliance_info_id) StripeMerchantAccountManager.handle_new_user_compliance_info(u...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/delete_wishlist_products_job.rb
Ruby
mit
8,966
main
318
# frozen_string_literal: true class DeleteWishlistProductsJob include Sidekiq::Job sidekiq_options queue: :low def perform(product_id) product = Link.find(product_id) return unless product.deleted? # user undid product deletion product.wishlist_products.alive.find_each(&:mark_deleted!) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/stripe_transfer_gumroads_available_balances_to_gumroads_bank_account_worker.rb
Ruby
mit
8,966
main
771
# frozen_string_literal: true class StripeTransferGumroadsAvailableBalancesToGumroadsBankAccountWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :default BALANCE_BUFFER_CENTS = 1_000_000_00 private_constant :BALANCE_BUFFER_CENTS def perform return unless Rails.env.production? || Rails.env.s...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_bundle_purchases_content_job.rb
Ruby
mit
8,966
main
586
# frozen_string_literal: true class UpdateBundlePurchasesContentJob include Sidekiq::Job sidekiq_options retry: 3, queue: :low def perform(bundle_id) bundle = Link.is_bundle.find(bundle_id) content_updated_at = bundle.bundle_products.alive.maximum(:updated_at) bundle.sales .is_bundle_purchas...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_integrations_on_tier_change_worker.rb
Ruby
mit
8,966
main
428
# frozen_string_literal: true class UpdateIntegrationsOnTierChangeWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(subscription_id) subscription = Subscription.find(subscription_id) [Integrations::CircleIntegrationService, Integrations::DiscordIntegrationService].each d...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_purchase_receipt_job.rb
Ruby
mit
8,966
main
748
# frozen_string_literal: true # Generates custom PDFs and sends a receipt # We want to make sure the receipt is sent after all the PDFs have been stamped # Exception: a receipt is not sent for bundle product pruchases, as they are dummy purchases # If there are PDFs that need to be stamped, the caller must enqueue thi...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_sendgrid_event_job.rb
Ruby
mit
8,966
main
514
# frozen_string_literal: true class HandleSendgridEventJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(params) events = params["_json"] events = [events] unless events.is_a?(Array) # Handling potential SendGrid weirdness where sometimes it might not give us an array. even...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_new_bank_account_worker.rb
Ruby
mit
8,966
main
1,032
# frozen_string_literal: true class HandleNewBankAccountWorker include Sidekiq::Job sidekiq_options retry: 10, queue: :default sidekiq_retries_exhausted do |msg, _exception| bank_account_id = msg["args"].first bank_account = BankAccount.find_by(id: bank_account_id) next unless bank_account cont...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/seller_updates_worker.rb
Ruby
mit
8,966
main
298
# frozen_string_literal: true class SellerUpdatesWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed def perform User.by_sales_revenue(days_ago: 7.days.ago, limit: nil) do |user| SellerUpdateWorker.perform_async(user.id) end end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/process_early_fraud_warning_job.rb
Ruby
mit
8,966
main
3,154
# frozen_string_literal: true class ProcessEarlyFraudWarningJob include Sidekiq::Job sidekiq_options retry: 5, queue: :default, lock: :until_executed def perform(early_fraud_warning_id) early_fraud_warning = EarlyFraudWarning.find(early_fraud_warning_id) return if early_fraud_warning.resolved? earl...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_stripe_merchant_account_worker.rb
Ruby
mit
8,966
main
316
# frozen_string_literal: true class CreateStripeMerchantAccountWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(user_id) user = User.find(user_id) StripeMerchantAccountManager.create_account(user, passphrase: GlobalConfig.get("STRONGBOX_GENERAL_PASSWORD")) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_stripe_event_worker.rb
Ruby
mit
8,966
main
217
# frozen_string_literal: true class HandleStripeEventWorker include Sidekiq::Job sidekiq_options retry: 10, queue: :default def perform(params) StripeEventHandler.new(params).handle_stripe_event end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_purchase_email_to_match_account_worker.rb
Ruby
mit
8,966
main
301
# frozen_string_literal: true class UpdatePurchaseEmailToMatchAccountWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(user_id) user = User.find(user_id) user.purchases.find_each do |purchase| purchase.update!(email: user.email) end end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_product_files_archive_worker.rb
Ruby
mit
8,966
main
8,317
# frozen_string_literal: true class UpdateProductFilesArchiveWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low PRODUCT_FILES_ARCHIVE_FILE_SIZE_LIMIT = 500.megabytes UNTITLED_FILENAME = "Untitled" # On an EXT4 file system, the command "getconf PATH_MAX /" returns 255 which # is an indicati...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/transfer_dropbox_file_to_s3_worker.rb
Ruby
mit
8,966
main
261
# frozen_string_literal: true class TransferDropboxFileToS3Worker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(dropbox_file_id) dropbox_file = DropboxFile.find(dropbox_file_id) dropbox_file.transfer_to_s3 end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_deferred_refunds_report_worker.rb
Ruby
mit
8,966
main
381
# frozen_string_literal: true class SendDeferredRefundsReportWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace def perform return unless Rails.env.production? last_month = Time.current.last_month AccountingMailer.deferred_refunds_rep...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/delete_old_unused_events_worker.rb
Ruby
mit
8,966
main
1,348
# frozen_string_literal: true class DeleteOldUnusedEventsWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low DELETION_BATCH_SIZE = 100 # Deletes non-permitted events within the default time window of: # (2 months and 2 days ago) .. (2 months ago) # # Params: # - `to` allows us to keep t...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/charge_successful_preorders_worker.rb
Ruby
mit
8,966
main
529
# frozen_string_literal: true class ChargeSuccessfulPreordersWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(preorder_link_id) preorder_link = PreorderLink.find_by(id: preorder_link_id) preorder_link.preorders.authorization_successful.each do |preorder| ChargePreo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_fees_by_creator_location_report_job.rb
Ruby
mit
8,966
main
3,588
# frozen_string_literal: true class GenerateFeesByCreatorLocationReportJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed def perform(month, year) raise ArgumentError, "Invalid month" unless month.in?(1..12) raise ArgumentError, "Invalid year" unless year.in?(2014....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/expire_stamped_pdfs_job.rb
Ruby
mit
8,966
main
450
# frozen_string_literal: true class ExpireStampedPdfsJob include Sidekiq::Job sidekiq_options queue: :low, retry: 5 RECENTNESS_LIMIT = 3.months BATCH_SIZE = 100 def perform loop do ReplicaLagWatcher.watch records = StampedPdf.alive.includes(:url_redirect, :product_file).where(created_at: .....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_purchasing_power_parity_factors_worker.rb
Ruby
mit
8,966
main
1,915
# frozen_string_literal: true class UpdatePurchasingPowerParityFactorsWorker include Sidekiq::Job include CurrencyHelper API_URL = "https://api.worldbank.org/v2/en/indicator/PA.NUS.PPP?downloadformat=csv" API_FILE_PREFIX = "API_PA" UPPER_THRESHOLD = 0.8 LOWER_THRESHOLD = 0.4 # High-income countries tha...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_utm_link_stats_job.rb
Ruby
mit
8,966
main
382
# frozen_string_literal: true class UpdateUtmLinkStatsJob include Sidekiq::Job sidekiq_options queue: :low, lock: :until_executed, retry: 1 def perform(utm_link_id) utm_link = UtmLink.find(utm_link_id) utm_link.update!( total_clicks: utm_link.utm_link_visits.count, unique_clicks: utm_link....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/block_object_worker.rb
Ruby
mit
8,966
main
304
# frozen_string_literal: true class BlockObjectWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(object_type, identifier, author_id, expires_in = nil) BlockedObject.block!(BLOCKED_OBJECT_TYPES[object_type.to_sym], identifier, author_id, expires_in:) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_workflow_installment_worker.rb
Ruby
mit
8,966
main
1,389
# frozen_string_literal: true class SendWorkflowInstallmentWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(installment_id, version, purchase_id, follower_id, affiliate_user_id = nil, subscription_id = nil) installment = Installment.find_by(id: installment_id) return if ins...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_sales_related_products_infos_job.rb
Ruby
mit
8,966
main
1,096
# frozen_string_literal: true class UpdateSalesRelatedProductsInfosJob include Sidekiq::Job sidekiq_options retry: 3, queue: :low def perform(purchase_id, increment = true) return if Feature.inactive?(:update_sales_related_products_infos) purchase = Purchase.find(purchase_id) product_id = purchase...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_auto_invoice_email_job.rb
Ruby
mit
8,966
main
494
# frozen_string_literal: true class SendAutoInvoiceEmailJob include Sidekiq::Job sidekiq_options queue: :low, retry: 3, lock: :until_executed def perform(purchase_id, charge_id) chargeable = Charge::Chargeable.find_by_purchase_or_charge!( purchase: Purchase.find_by(id: purchase_id), charge: Char...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/refresh_sitemap_monthly_worker.rb
Ruby
mit
8,966
main
816
# frozen_string_literal: true class RefreshSitemapMonthlyWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :low def perform # Update sitemap of products updated in the last month last_month_start = 1.month.ago.beginning_of_month last_month_end = last_month_start.end_of_month updated_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/calculate_sale_numbers_worker.rb
Ruby
mit
8,966
main
1,396
# frozen_string_literal: true class CalculateSaleNumbersWorker include Sidekiq::Job sidekiq_options retry: 2, queue: :default def perform calculate_stats_for_all_purchases end private def calculate_stats_for_all_purchases aggregations_body = { total_made: { sum: { field: "pr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_year_in_review_email_job.rb
Ruby
mit
8,966
main
6,480
# frozen_string_literal: true class SendYearInReviewEmailJob include Sidekiq::Job include CurrencyHelper sidekiq_options retry: 5, queue: :low MAX_SHOWCASE_RANK = 1_000 def perform(seller_id, year, recipient = nil) analytics_data = {} seller = User.find(seller_id) range = Date.new(year).all_yea...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/renew_custom_domain_ssl_certificates.rb
Ruby
mit
8,966
main
260
# frozen_string_literal: true class RenewCustomDomainSslCertificates include Sidekiq::Job sidekiq_options retry: 0, queue: :low def perform if SslCertificates::Renew.supported_environment? SslCertificates::Renew.new.process end end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_ssl_certificate.rb
Ruby
mit
8,966
main
412
# frozen_string_literal: true class GenerateSslCertificate include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(id) if SslCertificates::Generate.supported_environment? custom_domain = CustomDomain.find(id) return if custom_domain.deleted? # The domain was deleted after this job...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_user_balance_stats_cache_worker.rb
Ruby
mit
8,966
main
344
# frozen_string_literal: true class UpdateUserBalanceStatsCacheWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low, lock: :until_executed def perform(user_id) user = User.find(user_id) WithMaxExecutionTime.timeout_queries(seconds: 1.hour) do UserBalanceStatsService.new(user:).write_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/fail_abandoned_purchase_worker.rb
Ruby
mit
8,966
main
3,095
# frozen_string_literal: true class FailAbandonedPurchaseWorker include Sidekiq::Job, StripeErrorHandler sidekiq_options retry: 5, queue: :default attr_reader :purchase def perform(purchase_id) @purchase = Purchase.find(purchase_id) return unless purchase.in_progress? # Guard against the job ex...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_helper_event_worker.rb
Ruby
mit
8,966
main
1,568
# frozen_string_literal: true class HandleHelperEventWorker include Sidekiq::Job sidekiq_options retry: 3, queue: :default RECENT_PURCHASE_PERIOD = 1.year HELPER_EVENTS = %w[conversation.created] def perform(event, payload) return unless event.in?(HELPER_EVENTS) conversation_id = payload["convers...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_reminders_for_outstanding_user_compliance_info_requests_worker.rb
Ruby
mit
8,966
main
2,129
# frozen_string_literal: true class SendRemindersForOutstandingUserComplianceInfoRequestsWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :default TIME_UNTIL_REQUEST_NEEDS_REMINDER = 2.days MAX_NUMBER_OF_REMINDERS = 2 private_constant :MAX_NUMBER_OF_REMINDERS, :TIME_UNTIL_REQUEST_NEEDS_REMINDER...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_currencies_worker.rb
Ruby
mit
8,966
main
335
# frozen_string_literal: true class UpdateCurrenciesWorker include Sidekiq::Job include CurrencyHelper sidekiq_options retry: 5, queue: :default def perform rates = JSON.parse(URI.open(CURRENCY_SOURCE).read)["rates"] rates.each do |currency, rate| currency_namespace.set(currency.to_s, rate) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/recurring_charge_reminder_worker.rb
Ruby
mit
8,966
main
557
# frozen_string_literal: true class RecurringChargeReminderWorker include Sidekiq::Job sidekiq_options retry: 3, queue: :default def perform(subscription_id) subscription = Subscription.find(subscription_id) return if !subscription.alive?(include_pending_cancellation: false) || subscriptio...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/regenerate_sales_related_products_infos_job.rb
Ruby
mit
8,966
main
1,943
# frozen_string_literal: true # WARNING: This job can be very slow, and add a lot of rows to the DB. # It is only meant for rare cases, for example: improving quality of recommendations for a VIP creator's product. # It should NOT be run for more than a few of products at time. class RegenerateSalesRelatedProductsInfo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/custom_domains_verification_worker.rb
Ruby
mit
8,966
main
475
# frozen_string_literal: true class CustomDomainsVerificationWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low MAX_DURATION_TO_VERIFY_ALL_DOMAINS = 1.hour def perform CustomDomain.alive.find_each.with_index do |custom_domain, index| next if custom_domain.exceeding_max_failed_verific...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_memberships_price_update_emails_job.rb
Ruby
mit
8,966
main
826
# frozen_string_literal: true class SendMembershipsPriceUpdateEmailsJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform SubscriptionPlanChange.includes(:subscription) .applicable_for_product_price_change_as_of(7.days.from_now.to_date) .where(notified_subscriber_at: nil) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/recover_aus_backtaxes_from_stripe_accounts_job.rb
Ruby
mit
8,966
main
411
# frozen_string_literal: true class RecoverAusBacktaxesFromStripeAccountsJob include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform BacktaxAgreement .not_collected .where(jurisdiction: BacktaxAgreement::Jurisdictions::AUSTRALIA) .pluck(:user_id) .uniq .each ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/block_email_domains_worker.rb
Ruby
mit
8,966
main
317
# frozen_string_literal: true class BlockEmailDomainsWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(author_id, email_domains) email_domains.each do |email_domain| BlockedObject.block!(BLOCKED_OBJECT_TYPES[:email_domain], email_domain, author_id) end end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_paypal_topup_notification_job.rb
Ruby
mit
8,966
main
1,419
# frozen_string_literal: true class SendPaypalTopupNotificationJob include Sidekiq::Job include CurrencyHelper sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace def perform(notify_only_if_topup_needed = false) return unless Rails.env.production? balance_check = P...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/delete_product_rich_content_worker.rb
Ruby
mit
8,966
main
820
# frozen_string_literal: true class DeleteProductRichContentWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(product_id, variant_id = nil) product = Link.find(product_id) if variant_id.present? variant = BaseVariant.find(variant_id) delete_rich_content(produ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/regenerate_creator_analytics_cache_worker.rb
Ruby
mit
8,966
main
507
# frozen_string_literal: true class RegenerateCreatorAnalyticsCacheWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low, lock: :until_executed def perform(user_id, date_string) user = User.find(user_id) date = Date.parse(date_string) service = CreatorAnalytics::CachingProxy.new(user) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/invalidate_product_cache_worker.rb
Ruby
mit
8,966
main
254
# frozen_string_literal: true class InvalidateProductCacheWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(product_id) product = Link.find(product_id) product.invalidate_cache end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_missing_purchase_events_worker.rb
Ruby
mit
8,966
main
1,502
# frozen_string_literal: true class CreateMissingPurchaseEventsWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low def perform(date = Date.yesterday) purchases = Purchase.successful.left_joins(:events). where("purchases.created_at >= ? and purchases.created_at < ?", date, date.tomorrow)....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_us_states_sales_summary_report_job.rb
Ruby
mit
8,966
main
7,631
# frozen_string_literal: true class CreateUsStatesSalesSummaryReportJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed attr_reader :taxjar_api def perform(subdivision_codes, month, year, push_to_taxjar: true) raise ArgumentError, "Invalid month" unless month.in?(1.....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/expire_rental_purchases_worker.rb
Ruby
mit
8,966
main
278
# frozen_string_literal: true class ExpireRentalPurchasesWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :default def perform Purchase.rentals_to_expire.find_each do |purchase| purchase.rental_expired = true purchase.save! end end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/duplicate_product_worker.rb
Ruby
mit
8,966
main
610
# frozen_string_literal: true class DuplicateProductWorker include Sidekiq::Job sidekiq_options queue: :critical def perform(product_id) ProductDuplicatorService.new(product_id).duplicate rescue => e logger.error("Error while duplicating product id '#{product_id}': #{e.inspect}") ErrorNotifier.not...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_payment_reminder_worker.rb
Ruby
mit
8,966
main
544
# frozen_string_literal: true class SendPaymentReminderWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default def perform User.payment_reminder_risk_state.announcement_notification_enabled .where(payment_address: nil).holding_balance_more_than(1000) .find_each do |user| ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/transcode_video_for_streaming_worker.rb
Ruby
mit
8,966
main
9,332
# frozen_string_literal: true class TranscodeVideoForStreamingWorker include Sidekiq::Job include Rails.application.routes.url_helpers sidekiq_options retry: 13, queue: :default # Enforced by AWS Elastic Transcoder MAX_OUTPUT_KEY_PREFIX_BYTESIZE = 255 MEDIACONVERT = "mediaconvert" GRMC = "grmc" GRMC_E...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/order_review_reminder_job.rb
Ruby
mit
8,966
main
766
# frozen_string_literal: true class OrderReviewReminderJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(order_id) order = Order.find(order_id) eligible_purchases = order.purchases.select(&:eligible_for_review_reminder?) return if eligible_purchases.empty? SentEmailInfo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/suspend_users_worker.rb
Ruby
mit
8,966
main
1,706
# frozen_string_literal: true class SuspendUsersWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default DEFAULT_SCHEDULED_PAYOUT_DELAY_DAYS = 21 def perform(author_id, user_ids, reason, additional_notes, scheduled_payout = nil) author = User.find(author_id) author_name = author.name_or_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/post_to_ping_endpoints_worker.rb
Ruby
mit
8,966
main
1,346
# frozen_string_literal: true class PostToPingEndpointsWorker include Sidekiq::Job sidekiq_options retry: 20, queue: :critical def perform(purchase_id, url_parameters, resource_name = ResourceSubscription::SALE_RESOURCE_NAME, subscription_id = nil, additional_params = {}) ActiveRecord::Base.connection.stick...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_financial_reports_for_previous_month_job.rb
Ruby
mit
8,966
main
870
# frozen_string_literal: true class GenerateFinancialReportsForPreviousMonthJob include Sidekiq::Worker sidekiq_options retry: 1, queue: :default, lock: :until_executed def perform return unless Rails.env.production? prev_month_date = Date.current.prev_month CreateCanadaMonthlySalesReportJob.perfo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/analyze_file_worker.rb
Ruby
mit
8,966
main
465
# frozen_string_literal: true class AnalyzeFileWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(id, analyzable_klass_name = ProductFile.name) return if Rails.env.test? analyzable_klass_name.constantize.find(id).analyze rescue Aws::S3::Errors::NotFou...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/post_to_individual_ping_endpoint_worker.rb
Ruby
mit
8,966
main
2,769
# frozen_string_literal: true class PostToIndividualPingEndpointWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :critical ERROR_CODES_TO_RETRY = [499, 500, 502, 503, 504].freeze BACKOFF_STRATEGY = [60, 180, 600, 3600].freeze NOTIFICATION_THROTTLE_PERIOD = 1.week.freeze def perform(post_url, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_community_chat_recap_notifications_job.rb
Ruby
mit
8,966
main
2,241
# frozen_string_literal: true class SendCommunityChatRecapNotificationsJob include Sidekiq::Job sidekiq_options queue: :low, lock: :until_executed def perform(community_chat_recap_run_id) recap_run = CommunityChatRecapRun.find(community_chat_recap_run_id) return unless recap_run.finished? communit...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/cancel_subscriptions_for_product_worker.rb
Ruby
mit
8,966
main
452
# frozen_string_literal: true class CancelSubscriptionsForProductWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(product_id) product = Link.find(product_id) return unless product.deleted? # user undid product deletion product.subscriptions.active.each(&:cancel_effe...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_resend_event_job.rb
Ruby
mit
8,966
main
308
# frozen_string_literal: true class HandleResendEventJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(event_json) resend_event_info = ResendEventInfo.new(event_json) return if resend_event_info.invalid? HandleEmailEventInfo.perform(resend_event_info) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/process_purchase_early_fraud_warning_job.rb
Ruby
mit
8,966
main
203
# frozen_string_literal: true # Before removing this file, make sure there are no more enqueued jobs in production using the class name ProcessPurchaseEarlyFraudWarningJob = ProcessEarlyFraudWarningJob
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/deactivate_integrations_worker.rb
Ruby
mit
8,966
main
1,078
# frozen_string_literal: true class DeactivateIntegrationsWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(purchase_id) purchase = Purchase.find(purchase_id) purchases_to_process(purchase).each { deactivate_integrations(_1) } end private def purchases_to_proces...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/recover_aus_backtax_from_stripe_account_job.rb
Ruby
mit
8,966
main
599
# frozen_string_literal: true class RecoverAusBacktaxFromStripeAccountJob include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(creator_id) creator = User.find_by_id(creator_id) return unless creator.present? australia_backtax_agreement = creator.australia_backtax_agreement ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/review_reminder_job.rb
Ruby
mit
8,966
main
468
# frozen_string_literal: true class ReviewReminderJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(purchase_id) purchase = Purchase.find(purchase_id) return unless purchase.eligible_for_review_reminder? SentEmailInfo.ensure_mailer_uniqueness("CustomerLowPriorityMailer", "r...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/stripe_create_merchant_accounts_worker.rb
Ruby
mit
8,966
main
1,851
# frozen_string_literal: true class StripeCreateMerchantAccountsWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default PERIOD_INDICATING_USER_IS_ACTIVE = 3.months private_constant :PERIOD_INDICATING_USER_IS_ACTIVE def perform # Create Stripe accounts for users that have user compliance i...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_rental_expires_soon_email_worker.rb
Ruby
mit
8,966
main
567
# frozen_string_literal: true class SendRentalExpiresSoonEmailWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(purchase_id, time_till_rental_expiration_in_seconds) purchase = Purchase.find(purchase_id) url_redirect = purchase.url_redirect return if !url_redirect.is_r...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/schedule_abandoned_cart_emails_job.rb
Ruby
mit
8,966
main
3,086
# frozen_string_literal: true class ScheduleAbandonedCartEmailsJob include Sidekiq::Job BATCH_SIZE = 500 sidekiq_options queue: :low, retry: 5, lock: :until_executed def perform # cart_product_ids_with_cart_ids is a hash of { product_id => { cart_id => [variant_ids] } } cart_product_ids_with_cart_id...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/reissue_ssl_certificate_for_updated_custom_domains.rb
Ruby
mit
8,966
main
542
# frozen_string_literal: true class ReissueSslCertificateForUpdatedCustomDomains include Sidekiq::Job sidekiq_options retry: 0, queue: :low def perform CustomDomain.alive.where.not(ssl_certificate_issued_at: nil).find_each do |custom_domain| verification_service = CustomDomainVerificationService.new(d...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/suspend_accounts_with_payment_address_worker.rb
Ruby
mit
8,966
main
1,926
# frozen_string_literal: true class SuspendAccountsWithPaymentAddressWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(user_id) suspended_user = User.find(user_id) suspend_users_with_same_payment_address(suspended_user) suspend_users_with_same_stripe_fingerprint(susp...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_licenses_for_existing_customers_worker.rb
Ruby
mit
8,966
main
408
# frozen_string_literal: true class CreateLicensesForExistingCustomersWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(product_id) product = Link.find(product_id) product.sales.successful_gift_or_nongift.not_is_gift_sender_purchase.not_recurring_charge.find_each do |pur...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_canada_sales_report_job.rb
Ruby
mit
8,966
main
5,281
# frozen_string_literal: true class GenerateCanadaSalesReportJob include Sidekiq::Job def perform(month, year) raise ArgumentError, "Invalid month" unless month.in?(1..12) raise ArgumentError, "Invalid year" unless year.in?(2014..3200) begin temp_file = Tempfile.new temp_file.write(row_he...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/large_sellers_update_user_balance_stats_cache_worker.rb
Ruby
mit
8,966
main
371
# frozen_string_literal: true class LargeSellersUpdateUserBalanceStatsCacheWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low def perform user_ids = UserBalanceStatsService.cacheable_users.pluck(:id).map { |el| [el] } Sidekiq::Client.push_bulk( "class" => UpdateUserBalanceStatsCach...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/process_payment_worker.rb
Ruby
mit
8,966
main
335
# frozen_string_literal: true class ProcessPaymentWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(payment_id) payment = Payment.find(payment_id) return unless payment.processing? PayoutProcessorType.get(payment.processor).process_payments([payme...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/find_subscriptions_with_missing_charge_worker.rb
Ruby
mit
8,966
main
1,534
# frozen_string_literal: true class FindSubscriptionsWithMissingChargeWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :low BATCHES_SCHEDULE_MARGIN_IN_MINUTES = 20 def perform(batch_number = nil) if batch_number.nil? 10.times { |i| self.class.perform_in(i * BATCHES_SCHEDULE_MARGIN_IN_MIN...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_india_sales_report_job.rb
Ruby
mit
8,966
main
4,123
# frozen_string_literal: true class CreateIndiaSalesReportJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace def perform(month = nil, year = nil) if month.nil? || year.nil? previous_month = 1.month.ago month ||= previous_month.month ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/compile_gumroad_daily_analytics_job.rb
Ruby
mit
8,966
main
386
# frozen_string_literal: true class CompileGumroadDailyAnalyticsJob include Sidekiq::Job sidekiq_options retry: 0, queue: :default REFRESH_PERIOD = 45.days private_constant :REFRESH_PERIOD def perform start_date = Date.today - REFRESH_PERIOD end_date = Date.today (start_date..end_date).each do...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/delete_stripe_apple_pay_domain_worker.rb
Ruby
mit
8,966
main
419
# frozen_string_literal: true class DeleteStripeApplePayDomainWorker include Sidekiq::Job sidekiq_options retry: 3, queue: :low def perform(user_id, domain) record = StripeApplePayDomain.find_by(user_id:, domain:) return unless record response = Stripe::ApplePayDomain.delete(record.stripe_id) re...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_us_state_monthly_sales_reports_job.rb
Ruby
mit
8,966
main
9,148
# frozen_string_literal: true # Usage example for the month of August 2022 in the state of Washington: # # CreateUsStateMonthlySalesReportsJob.perform_async("WA", 8, 2022) class CreateUsStateMonthlySalesReportsJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed attr_reader ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/delete_old_versions_records_worker.rb
Ruby
mit
8,966
main
620
# frozen_string_literal: true class DeleteOldVersionsRecordsWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low MAX_ALLOWED_ROWS = 100_000_000 DELETION_BATCH_SIZE = 100 # Counting rows is not free, so we're relying on the fact that ids are consecutive instead. def perform max_id = Paper...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_paypal_event_worker.rb
Ruby
mit
8,966
main
228
# frozen_string_literal: true class HandlePaypalEventWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(paypal_event) PaypalEventHandler.new(paypal_event).handle_paypal_event end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/end_subscription_worker.rb
Ruby
mit
8,966
main
432
# frozen_string_literal: true class EndSubscriptionWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(subscription_id) subscription = Subscription.find(subscription_id) return if subscription.is_test_subscription? return unless subscription.alive?(include_pending_cance...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_seller_refund_eligibility_job.rb
Ruby
mit
8,966
main
510
# frozen_string_literal: true class UpdateSellerRefundEligibilityJob include Sidekiq::Job sidekiq_options retry: 2, queue: :default def perform(user_id) user = User.find(user_id) unpaid_balance_cents = user.unpaid_balance_cents if unpaid_balance_cents > 0 && user.refunds_disabled? user.enable...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_installment_events_count_cache_worker.rb
Ruby
mit
8,966
main
523
# frozen_string_literal: true class UpdateInstallmentEventsCountCacheWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low, lock: :until_executed def perform(installment_id) installment = Installment.find(installment_id) total = installment.installment_events.count # This is a hot-fix fo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_cached_sales_related_products_infos_job.rb
Ruby
mit
8,966
main
948
# frozen_string_literal: true class UpdateCachedSalesRelatedProductsInfosJob include Sidekiq::Job sidekiq_options retry: 3, queue: :low, lock: :until_executed # We don't need to store the fact that a (popular) product is related to 100k other ones, # especially when many of these have been only purchased a sm...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/rename_product_file_worker.rb
Ruby
mit
8,966
main
300
# frozen_string_literal: true class RenameProductFileWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(product_file_id) file = ProductFile.find_by(id: product_file_id) return if file.nil? || file.deleted_from_cdn? file.rename_in_storage end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_vat_report_job.rb
Ruby
mit
8,966
main
6,452
# frozen_string_literal: true class CreateVatReportJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace DEFAULT_VAT_RATE_TYPE = "Standard" REDUCED_VAT_RATE_TYPE = "Reduced" def perform(quarter, year) raise ArgumentError, "Invalid quarter" unle...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_large_sellers_sales_count_job.rb
Ruby
mit
8,966
main
452
# frozen_string_literal: true class UpdateLargeSellersSalesCountJob include Sidekiq::Job sidekiq_options retry: 1, queue: :low def perform LargeSeller.find_each(batch_size: 100) do |large_seller| next unless large_seller.user current_sales_count = large_seller.user.sales.count if current...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_charge_receipt_job.rb
Ruby
mit
8,966
main
800
# frozen_string_literal: true # Job used to send the initial receipt email after checkout for a given charge. # If there are PDFs that need to be stamped, the caller must enqueue this job using the "default" queue # class SendChargeReceiptJob include Sidekiq::Job sidekiq_options queue: :critical, retry: 5, lock: :...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/fight_disputes_job.rb
Ruby
mit
8,966
main
378
# frozen_string_literal: true class FightDisputesJob include Sidekiq::Job sidekiq_options retry: 3, queue: :default, lock: :until_executed def perform DisputeEvidence.not_resolved.find_each do |dispute_evidence| next if dispute_evidence.hours_left_to_submit_evidence.positive? FightDisputeJob.per...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_finances_report_worker.rb
Ruby
mit
8,966
main
373
# frozen_string_literal: true class SendFinancesReportWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace def perform return unless Rails.env.production? last_month = Time.current.last_month AccountingMailer.funds_received_report(last...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_preorder_seller_summary_worker.rb
Ruby
mit
8,966
main
1,299
# frozen_string_literal: true class SendPreorderSellerSummaryWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low MAX_ATTEMPTS_TO_WAIT_FOR_ALL_CHARGED = 72 # roughly 24h, but could be longer if the queue is backed up WAIT_PERIOD = 20.minutes def perform(preorder_link_id, attempts = 0) if a...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_workflow_post_emails_job.rb
Ruby
mit
8,966
main
2,354
# frozen_string_literal: true class SendWorkflowPostEmailsJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(post_id, earliest_valid_time = nil) @post = Installment.find(post_id) @workflow = @post.workflow return unless @workflow.alive? && @post.alive? && @post.published? ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_post_blast_emails_job.rb
Ruby
mit
8,966
main
7,139
# frozen_string_literal: true class SendPostBlastEmailsJob include Sidekiq::Job include ActionView::Helpers::SanitizeHelper sidekiq_options retry: 10, queue: :default, lock: :until_executed def perform(blast_id) @blast = PostEmailBlast.find(blast_id) @post = @blast.post Rails.logger.info("[#{self....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_wishlist_updated_emails_job.rb
Ruby
mit
8,966
main
1,205
# frozen_string_literal: true class SendWishlistUpdatedEmailsJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(wishlist_id, wishlist_product_ids) wishlist = Wishlist.find(wishlist_id) wishlist_products = wishlist.wishlist_products.alive.where(id: wishlist_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/publish_scheduled_post_job.rb
Ruby
mit
8,966
main
831
# frozen_string_literal: true class PublishScheduledPostJob include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(post_id, version) post = Installment.find(post_id) post.with_lock do return unless post.alive? # post may have been deleted return if post.published? # no n...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/build_tax_rate_cache_worker.rb
Ruby
mit
8,966
main
501
# frozen_string_literal: true class BuildTaxRateCacheWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default def perform us_tax_cache_namespace = Redis::Namespace.new(:max_tax_rate_per_state_cache_us, redis: $redis) ZipTaxRate.where("state is NOT NULL").group(:state).maximum(:combined_rate...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/payout_users_worker.rb
Ruby
mit
8,966
main
426
# frozen_string_literal: true class PayoutUsersWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :default, lock: :until_executed def perform(date_string, processor_type, user_ids, payout_type = Payouts::PAYOUT_TYPE_STANDARD) PayoutUsersService.new(date_string:, processo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_sales_report_job.rb
Ruby
mit
8,966
main
5,232
# frozen_string_literal: true class GenerateSalesReportJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace ALL_SALES = "all_sales" DISCOVER_SALES = "discover_sales" SALES_TYPES = [ALL_SALES, DISCOVER_SALES] def perform(country_code, start_date,...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/check_payment_address_worker.rb
Ruby
mit
8,966
main
1,534
# frozen_string_literal: true class CheckPaymentAddressWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :default def perform(user_id) user = User.find_by(id: user_id) return unless user&.can_flag_for_fraud? should_flag = payment_address_matches_suspended_account?(user) || ...