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_payout_reversed_worker.rb
Ruby
mit
8,966
main
1,620
# frozen_string_literal: true class HandlePayoutReversedWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(payment_id, reversing_payout_id, stripe_connect_account_id) @reversing_payout_id = reversing_payout_id @stripe_connect_account_id = stripe_connect_account_id if ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/collect_unclaimed_balances_of_inactive_stripe_accounts_job.rb
Ruby
mit
8,966
main
3,447
# frozen_string_literal: true class CollectUnclaimedBalancesOfInactiveStripeAccountsJob include Sidekiq::Job sidekiq_options retry: 5, queue: :default # Stripe considers these accounts inactive after >=3 years, so we use the same time frame. # Ref: https://support.stripe.com/questions/unclaimed-balances-faqs-...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_subscribe_preview_job.rb
Ruby
mit
8,966
main
581
# frozen_string_literal: true class GenerateSubscribePreviewJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(user_id) user = User.find(user_id) image = SubscribePreviewGeneratorService.generate_pngs([user]).first if image.blank? raise "Subscri...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/reset_admin_action_call_counts_job.rb
Ruby
mit
8,966
main
545
# frozen_string_literal: true class ResetAdminActionCallCountsJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform Rails.application.eager_load! AdminActionCallInfo.transaction do AdminActionCallInfo.destroy_all Admin::BaseController.descendants.each do |controller_cla...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/unsubscribe_and_fail_worker.rb
Ruby
mit
8,966
main
439
# frozen_string_literal: true class UnsubscribeAndFailWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(subscription_id) subscription = Subscription.find(subscription_id) return if !subscription.alive?(include_pending_cancellation: false) || subscription.is_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/refresh_sitemap_daily_worker.rb
Ruby
mit
8,966
main
215
# frozen_string_literal: true class RefreshSitemapDailyWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :low def perform(date = Date.current.to_s) SitemapService.new.generate(date) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/custom_domain_verification_worker.rb
Ruby
mit
8,966
main
357
# frozen_string_literal: true class CustomDomainVerificationWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(custom_domain_id) custom_domain = CustomDomain.find(custom_domain_id) return if custom_domain.deleted? return unless custom_domain.valid? custom_domain.veri...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/recalculate_recent_wishlist_follower_count_job.rb
Ruby
mit
8,966
main
482
# frozen_string_literal: true class RecalculateRecentWishlistFollowerCountJob include Sidekiq::Job def perform Wishlist.find_in_batches do |batch| follower_counts = WishlistFollower.alive .where(wishlist_id: batch.map(&:id)) .where("created_at > ?", 30.days.ago) .group(:wishlist_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_taxonomy_stats_job.rb
Ruby
mit
8,966
main
1,312
# frozen_string_literal: true class UpdateTaxonomyStatsJob include Sidekiq::Job sidekiq_options retry: 3, queue: :low def perform taxonomies = Taxonomy.roots taxonomies.each do |taxonomy| descendant_ids = taxonomy.descendant_ids stat = TaxonomyStat.find_or_create_by!(taxonomy:) shared...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/charge_declined_reminder_worker.rb
Ruby
mit
8,966
main
514
# frozen_string_literal: true class ChargeDeclinedReminderWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(subscription_id) subscription = Subscription.find(subscription_id) return if !subscription.alive?(include_pending_cancellation: false) || subscription...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/delete_product_files_worker.rb
Ruby
mit
8,966
main
354
# frozen_string_literal: true class DeleteProductFilesWorker 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 return if product.has_successful_sales? product.produc...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_grmc_callback_job.rb
Ruby
mit
8,966
main
1,098
# frozen_string_literal: true class HandleGrmcCallbackJob include Sidekiq::Job sidekiq_options retry: 2, queue: :default def perform(notification) ActiveRecord::Base.connection.stick_to_primary! transcoded_video_from_job = TranscodedVideo.processing.find_by(job_id: notification["job_id"]) return if...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/reindex_recommendable_products_worker.rb
Ruby
mit
8,966
main
1,402
# frozen_string_literal: true class ReindexRecommendableProductsWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default SCROLL_SIZE = 1000 SCROLL_SORT = ["_doc"] def perform response = EsClient.search( index: Link.index_name, scroll: "1m", body: { query: { term: { is_rec...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/delete_old_sent_email_info_records_job.rb
Ruby
mit
8,966
main
439
# frozen_string_literal: true class DeleteOldSentEmailInfoRecordsJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low VALID_DURATION = 1.year DELETION_BATCH_SIZE = 100 def perform return unless SentEmailInfo.exists? loop do ReplicaLagWatcher.watch rows = SentEmailInfo.where("...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/unblock_object_worker.rb
Ruby
mit
8,966
main
204
# frozen_string_literal: true class UnblockObjectWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(object_value) BlockedObject.unblock!(object_value) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/cancel_preorder_worker.rb
Ruby
mit
8,966
main
320
# frozen_string_literal: true class CancelPreorderWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(preorder_id) preorder = Preorder.find_by(id: preorder_id) return unless preorder.is_authorization_successful? preorder.mark_cancelled!(auto_cancelled: true) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_stripe_currency_balances_report_job.rb
Ruby
mit
8,966
main
412
# frozen_string_literal: true class SendStripeCurrencyBalancesReportJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace def perform return unless Rails.env.production? balances_csv = StripeCurrencyBalancesReport.stripe_currency_balances_repor...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_stripe_autodebit_for_negative_balance.rb
Ruby
mit
8,966
main
1,482
# frozen_string_literal: true class HandleStripeAutodebitForNegativeBalance include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(stripe_event_id, stripe_connect_account_id, stripe_payout_id) @stripe_connect_account_id = stripe_connect_account_id @stripe_payout_id = stripe_payout_id...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/utm_link_sale_attribution_job.rb
Ruby
mit
8,966
main
2,235
# frozen_string_literal: true class UtmLinkSaleAttributionJob include Sidekiq::Job ATTRIBUTION_WINDOW = 7.days sidekiq_options queue: :low, lock: :until_executed, retry: 3 def perform(order_id, browser_guid) purchases_by_seller = Order.find(order_id).purchases.successful.group_by(&:seller_id) # Fet...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/export_payout_data.rb
Ruby
mit
8,966
main
2,966
# frozen_string_literal: true class ExportPayoutData include Sidekiq::Job sidekiq_options retry: 5, queue: :low def initialize @tempfiles_to_cleanup = [] end def perform(payment_ids, recipient_user_id) payment_ids = Array.wrap(payment_ids) payouts = generate_payouts(payment_ids) return if ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/fight_dispute_job.rb
Ruby
mit
8,966
main
908
# frozen_string_literal: true class FightDisputeJob include Sidekiq::Job sidekiq_options retry: 5, queue: :default, lock: :until_executed def perform(dispute_id) dispute = Dispute.find(dispute_id) dispute_evidence = dispute.dispute_evidence return if dispute_evidence.resolved? return if dispute_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/cache_product_data_worker.rb
Ruby
mit
8,966
main
290
# frozen_string_literal: true class CacheProductDataWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(product_id) product = Link.find(product_id) product.invalidate_cache product.product_cached_values.create! end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/subtitle_file_size_worker.rb
Ruby
mit
8,966
main
273
# frozen_string_literal: true class SubtitleFileSizeWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(subtitle_file_id) file = SubtitleFile.find_by(id: subtitle_file_id) return if file.nil? file.calculate_size end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/million_dollar_milestone_check_worker.rb
Ruby
mit
8,966
main
1,910
# frozen_string_literal: true class MillionDollarMilestoneCheckWorker include Sidekiq::Job include Rails.application.routes.url_helpers MILLION_DOLLARS_IN_CENTS = 1_000_000_00 sidekiq_options retry: 5, queue: :low def perform purchase_creation_time_range = Range.new(3.weeks.ago.days_ago(2), 2.weeks.ag...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/set_subscription_as_deactivated_worker.rb
Ruby
mit
8,966
main
321
# frozen_string_literal: true class SetSubscriptionAsDeactivatedWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default, lock: :until_executed def perform(subscription_id) subscription = Subscription.find(subscription_id) return if subscription.alive? subscription.deactivate! end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_last_post_job.rb
Ruby
mit
8,966
main
733
# frozen_string_literal: true class SendLastPostJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(purchase_id) purchase = Purchase.find(purchase_id) subscription = purchase.subscription posts = Installment.emailable_posts_for_purchase(purchase:).order(published_at: :desc) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/pdf_unstampable_notifier_job.rb
Ruby
mit
8,966
main
1,267
# frozen_string_literal: true class PdfUnstampableNotifierJob include Sidekiq::Job sidekiq_options queue: :default, retry: 5 def perform(product_id) product = Link.find(product_id) total_files_checked = 0 total_unstampable_files = 0 product.product_files.alive.pdf.pdf_stamp_enabled.where(stamp...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/stamp_pdf_for_purchase_job.rb
Ruby
mit
8,966
main
762
# frozen_string_literal: true # Stamps PDF(s) for a purchase class StampPdfForPurchaseJob include Sidekiq::Job sidekiq_options queue: :long, retry: 5, lock: :until_executed def perform(purchase_id, notify_buyer = false) purchase = Purchase.find(purchase_id) PdfStampingService.stamp_for_purchase!(purchas...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/push_notification_worker.rb
Ruby
mit
8,966
main
1,068
# frozen_string_literal: true class PushNotificationWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :critical def perform(receiver_id, app_type, title, body = nil, data = {}, sound = nil) receiver = User.find receiver_id receiver.devices.where(app_type:).each do |device| case device....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/google_calendar_invite_job.rb
Ruby
mit
8,966
main
2,243
# frozen_string_literal: true class GoogleCalendarInviteJob include Sidekiq::Job def perform(call_id) call = Call.find(call_id) return if call.google_calendar_event_id.present? link = call.link buyer = call.purchase.purchaser&.email || call.purchase.email google_calendar_integration = link.g...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/block_suspended_account_ip_worker.rb
Ruby
mit
8,966
main
655
# frozen_string_literal: true class BlockSuspendedAccountIpWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(user_id) user = User.find(user_id) return if user.last_sign_in_ip.blank? return if User.where( "(current_sign_in_ip = :ip OR last_sign_in_ip = :ip OR acc...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/perform_payouts_up_to_delay_days_ago_worker.rb
Ruby
mit
8,966
main
869
# frozen_string_literal: true class PerformPayoutsUpToDelayDaysAgoWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :critical, lock: :until_executed def perform(payout_processor_type, bank_account_types = nil) payout_period_end_date = User::PayoutSchedule.next_scheduled_payout_end_date Rails...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/remove_deleted_files_from_s3_job.rb
Ruby
mit
8,966
main
2,691
# frozen_string_literal: true class RemoveDeletedFilesFromS3Job include Sidekiq::Job sidekiq_options retry: 1, queue: :low # There is no need to try to remove S3 objects from records that were marked as deleted years ago, and whose removal failed: # those will need to be dealt with manually. # Because this ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/sync_stuck_purchases_job.rb
Ruby
mit
8,966
main
1,072
# frozen_string_literal: true class SyncStuckPurchasesJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed def perform purchase_creation_time_range = Range.new(3.days.ago, 4.hours.ago) Purchase.in_progress.created_between(purchase_creation_time_range).each do |purch...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/refund_purchase_worker.rb
Ruby
mit
8,966
main
394
# frozen_string_literal: true class RefundPurchaseWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(purchase_id, admin_user_id, reason = nil) purchase = Purchase.find(purchase_id) if reason == Refund::FRAUD purchase.refund_for_fraud_and_block_buyer!(admin_user_id) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/sync_stuck_payouts_job.rb
Ruby
mit
8,966
main
1,462
# frozen_string_literal: true class SyncStuckPayoutsJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed def perform(processor) stuck_payments(processor).find_each do |payment| Rails.logger.info("Syncing #{processor} payout #{payment.id} stuck in #{payment.state} s...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/mass_refund_for_fraud_job.rb
Ruby
mit
8,966
main
1,326
# frozen_string_literal: true class MassRefundForFraudJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed def perform(product_id, external_ids, admin_user_id) results = { success: 0, failed: 0, errors: {} } external_ids.each do |external_id| purchase = Purcha...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/find_expired_subscriptions_to_set_as_deactivated_worker.rb
Ruby
mit
8,966
main
731
# frozen_string_literal: true class FindExpiredSubscriptionsToSetAsDeactivatedWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :default def perform now = Time.current relations = [ Subscription.where("cancelled_at < ? and deactivated_at is null", now).not_is_test_subscription.select(:i...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/purge_old_deleted_asset_previews_worker.rb
Ruby
mit
8,966
main
434
# frozen_string_literal: true class PurgeOldDeletedAssetPreviewsWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low DELETION_BATCH_SIZE = 100 def perform(to: 1.month.ago) loop do asset_previews = AssetPreview.deleted.where("deleted_at < ?", to).limit(DELETION_BATCH_SIZE).load bre...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/moderate_products_job.rb
Ruby
mit
8,966
main
510
# frozen_string_literal: true class ModerateProductsJob include Sidekiq::Job sidekiq_options queue: :low, retry: 3 def perform(product_ids) Link.where(id: product_ids).find_each do |product| ContentModeration::ModerateRecordService.check(product, :product) rescue StandardError => e ErrorNoti...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/trigger_community_chat_recap_run_job.rb
Ruby
mit
8,966
main
1,227
# frozen_string_literal: true class TriggerCommunityChatRecapRunJob include Sidekiq::Job sidekiq_options queue: :low, retry: 3, lock: :until_executed def perform(recap_frequency, from_date = nil) raise ArgumentError, "Recap frequency must be daily or weekly" unless recap_frequency.in?(CommunityChatRecapRun...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/annual_tax_summary_export_worker.rb
Ruby
mit
8,966
main
435
# frozen_string_literal: true class AnnualTaxSummaryExportWorker include Sidekiq::Job sidekiq_options queue: :low def perform(year, start = nil, finish = nil) csv_url = nil WithMaxExecutionTime.timeout_queries(seconds: 4.hour) do csv_url = Exports::TaxSummary::Annual.new(year:, start:, finish:).p...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/force_finish_long_running_community_chat_recap_runs_job.rb
Ruby
mit
8,966
main
586
# frozen_string_literal: true class ForceFinishLongRunningCommunityChatRecapRunsJob include Sidekiq::Job MAX_RUNNING_TIME_IN_HOURS = 6 def perform CommunityChatRecapRun.running.where("created_at < ?", MAX_RUNNING_TIME_IN_HOURS.hours.ago).find_each do |recap_run| recap_run.community_chat_recaps.status...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/refund_unpaid_purchases_worker.rb
Ruby
mit
8,966
main
499
# frozen_string_literal: true class RefundUnpaidPurchasesWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default def perform(user_id, admin_user_id) user = User.find(user_id) return unless user.suspended? unpaid_balance_ids = user.balances.unpaid.ids user.sales.where(purchase_succ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/recurring_charge_worker.rb
Ruby
mit
8,966
main
3,454
# frozen_string_literal: true class RecurringChargeWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default, lock: :until_executed def perform(subscription_id, ignore_consecutive_failures = false, _deprecated = nil) ActiveRecord::Base.connection.stick_to_primary! SuoSemaphore.recurring_char...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_username_job.rb
Ruby
mit
8,966
main
446
# frozen_string_literal: true class GenerateUsernameJob include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(user_id) user = User.find(user_id) return if user.read_attribute(:username).present? username = UsernameGeneratorService.new(user).username return if username.nil? ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_sns_aws_config_event_worker.rb
Ruby
mit
8,966
main
2,018
# frozen_string_literal: true class HandleSnsAwsConfigEventWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low MESSAGE_TYPES_TO_IGNORE = %w[ ConfigurationSnapshotDeliveryStarted ConfigurationSnapshotDeliveryCompleted ConfigurationHistoryDeliveryCompleted ].freeze private_constant :...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_stripe_apple_pay_domain_worker.rb
Ruby
mit
8,966
main
592
# frozen_string_literal: true class CreateStripeApplePayDomainWorker include Sidekiq::Job sidekiq_options retry: 3, queue: :low def perform(user_id, domain = nil) return if Rails.env.test? user = User.find(user_id) domain ||= Subdomain.from_username(user.username) if domain && StripeApplePayDo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/charge_preorder_worker.rb
Ruby
mit
8,966
main
1,544
# frozen_string_literal: true class ChargePreorderWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default MAX_ATTEMPTS = 4 TIME_BETWEEN_RETRIES = 6.hours PREORDER_AUTO_CANCEL_WAIT_TIME = 2.weeks def perform(preorder_id, attempts = 1) Rails.logger.info "ChargePreorder: attempting to char...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/calculate_payout_numbers_worker.rb
Ruby
mit
8,966
main
907
# frozen_string_literal: true class CalculatePayoutNumbersWorker include Sidekiq::Job sidekiq_options retry: 2, queue: :default def perform now = Time.now.in_time_zone("America/Los_Angeles") beginning_of_last_week = now.prev_week end_of_last_week = beginning_of_last_week.end_of_week search_resul...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_sns_mediaconvert_event_worker.rb
Ruby
mit
8,966
main
1,299
# frozen_string_literal: true class HandleSnsMediaconvertEventWorker include Sidekiq::Job include TranscodeEventHandler sidekiq_options retry: 5, queue: :default ERROR_STATUS = "ERROR" def perform(notification) return unless notification["Type"] == "Notification" message = JSON.parse(notification[...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_global_sales_tax_summary_report_job.rb
Ruby
mit
8,966
main
13,597
# frozen_string_literal: true class CreateGlobalSalesTaxSummaryReportJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed # GROUP BY uses HEX(CAST(... AS BINARY)) to prevent MySQL's case-insensitive collation # from silently merging rows like "USA" and "usa" — Ruby handles...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/seller_update_worker.rb
Ruby
mit
8,966
main
458
# frozen_string_literal: true class SellerUpdateWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :default def perform(user_id) user = User.find(user_id) ContactingCreatorMailer.seller_update(user.id).deliver_later(queue: "critical") if user.form_email && user.announcement_notification_enable...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/expire_transcoded_videos_job.rb
Ruby
mit
8,966
main
613
# frozen_string_literal: true class ExpireTranscodedVideosJob include Sidekiq::Job sidekiq_options queue: :low, retry: 5 BATCH_SIZE = 100 def perform recentness_limit = $redis.get(RedisKey.transcoded_videos_recentness_limit_in_months) recentness_limit ||= 12 * 100 # 100 years => do not expire by defa...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/delete_product_files_archives_worker.rb
Ruby
mit
8,966
main
761
# frozen_string_literal: true class DeleteProductFilesArchivesWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(product_id = nil, variant_id = nil) return if product_id.nil? && variant_id.nil? variant = BaseVariant.find(variant_id) if variant_id.present? product = pr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/cache_unreviewed_users_data_worker.rb
Ruby
mit
8,966
main
212
# frozen_string_literal: true class CacheUnreviewedUsersDataWorker include Sidekiq::Job sidekiq_options retry: 2, queue: :default def perform Admin::UnreviewedUsersService.cache_users_data! end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/retry_failed_paypal_payouts_worker.rb
Ruby
mit
8,966
main
1,200
# frozen_string_literal: true class RetryFailedPaypalPayoutsWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :critical, lock: :until_executed def perform payout_period_end_date = User::PayoutSchedule.manual_payout_end_date failed_payments_users = User.joins(:payments) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_payout_status_worker.rb
Ruby
mit
8,966
main
2,151
# frozen_string_literal: true class UpdatePayoutStatusWorker include Sidekiq::Job sidekiq_options retry: 25, queue: :default, lock: :until_executed def perform(payment_id) payment = Payment.find(payment_id) Rails.logger.info("UpdatePayoutStatusWorker invoked for payment #{payment_id}") # This job ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/log_resend_event_job.rb
Ruby
mit
8,966
main
657
# frozen_string_literal: true class LogResendEventJob 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? return unless resend_event_info.type.in?([ResendEventInfo::EVENT_OPENED, R...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/delete_expired_product_cached_values_worker.rb
Ruby
mit
8,966
main
942
# frozen_string_literal: true class DeleteExpiredProductCachedValuesWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low QUERY_BATCH_SIZE = 200 DELETION_BATCH_SIZE = 100 # Deletes all rows, except the latest one per product. # While still present in the queries for performance, the `expired`...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/low_balance_fraud_check_worker.rb
Ruby
mit
8,966
main
276
# frozen_string_literal: true class LowBalanceFraudCheckWorker include Sidekiq::Job sidekiq_options retry: 2, queue: :default def perform(purchase_id) creator = Purchase.find(purchase_id).seller creator.check_for_low_balance_and_probate(purchase_id) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/annual_payout_export_worker.rb
Ruby
mit
8,966
main
1,188
# frozen_string_literal: true class AnnualPayoutExportWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low def perform(user_id, year, send_email = false) user = User.find user_id payout_data = nil WithMaxExecutionTime.timeout_queries(seconds: 1.hour) do payout_data = Exports::Pay...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/internal_notification_worker.rb
Ruby
mit
8,966
main
418
# frozen_string_literal: true class InternalNotificationWorker include Sidekiq::Job sidekiq_options retry: 9, queue: :default def perform(room_name, sender, message_text, _color = "gray", options = {}) InternalNotificationMailer.notify( room_name: room_name, sender: sender, message_text: m...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/elasticsearch_indexer_worker.rb
Ruby
mit
8,966
main
5,149
# frozen_string_literal: true class ElasticsearchIndexerWorker include Sidekiq::Job sidekiq_options retry: 10, queue: :default UPDATE_BY_QUERY_SCROLL_SIZE = 100 # Usage examples: # .perform("index", { "class_name" => "Link", "record_id" => 1 } ) # .perform("delete", { "class_name" => "Link", "record_id" ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/reindex_user_elasticsearch_data_worker.rb
Ruby
mit
8,966
main
531
# frozen_string_literal: true class ReindexUserElasticsearchDataWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low, lock: :until_executed ADMIN_NOTE = "Refreshed ES Data" def perform(user_id, admin_id) user = User.find user_id admin = User.find admin_id DevTools.reindex_all_for_us...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/activate_integrations_worker.rb
Ruby
mit
8,966
main
277
# frozen_string_literal: true class ActivateIntegrationsWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(purchase_id) purchase = Purchase.find(purchase_id) Integrations::CircleIntegrationService.new.activate(purchase) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/create_canada_monthly_sales_report_job.rb
Ruby
mit
8,966
main
3,876
# frozen_string_literal: true class CreateCanadaMonthlySalesReportJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace def perform(month, year) raise ArgumentError, "Invalid month" unless month.in?(1..12) raise ArgumentError, "Invalid year" unl...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/schedule_membership_price_updates_job.rb
Ruby
mit
8,966
main
3,667
# frozen_string_literal: true class ScheduleMembershipPriceUpdatesJob include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(tier_id) tier = Variant.find(tier_id) return unless tier.apply_price_changes_to_existing_memberships? product = tier.link return unless product.is_tiered_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/email_outstanding_balances_csv_worker.rb
Ruby
mit
8,966
main
312
# frozen_string_literal: true class EmailOutstandingBalancesCsvWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :raise def perform return unless Rails.env.production? AccountingMailer.email_outstanding_balances_csv.deliver_now end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_bundles_marketing_email_job.rb
Ruby
mit
8,966
main
2,254
# frozen_string_literal: true class SendBundlesMarketingEmailJob MINIMUM_PRODUCTS_PER_BUNDLE = 2 LAST_YEAR = 1.year.ago.year def perform User.not_suspended .where(deleted_at: nil) .joins(:payments) .merge(Payment.completed.where(created_at: 1.year.ago..)) .select("users.id, u...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_community_chat_recap_job.rb
Ruby
mit
8,966
main
846
# frozen_string_literal: true class GenerateCommunityChatRecapJob include Sidekiq::Job sidekiq_options queue: :low, retry: 1, lock: :until_executed def perform(community_chat_recap_id) community_chat_recap = CommunityChatRecap.find(community_chat_recap_id) CommunityChatRecapGeneratorService.new(communi...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/handle_sns_transcoder_event_worker.rb
Ruby
mit
8,966
main
416
# frozen_string_literal: true class HandleSnsTranscoderEventWorker include Sidekiq::Job include TranscodeEventHandler sidekiq_options retry: 5, queue: :default def perform(params) if params["Type"] == "Notification" message = JSON.parse(params["Message"]) job_id = message["jobId"] state...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/free_trial_expiring_reminder_worker.rb
Ruby
mit
8,966
main
731
# frozen_string_literal: true class FreeTrialExpiringReminderWorker include Sidekiq::Job sidekiq_options retry: 3, queue: :default def perform(subscription_id) subscription = Subscription.find(subscription_id) return unless subscription.alive?(include_pending_cancellation: false) && su...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/send_to_elasticsearch_worker.rb
Ruby
mit
8,966
main
359
# frozen_string_literal: true class SendToElasticsearchWorker include Sidekiq::Job sidekiq_options retry: 10, queue: :default def perform(link_id, action, attributes_to_update = []) return if (product = Link.find_by(id: link_id)).nil? ProductIndexingService.perform( product:, action:, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/log_sendgrid_event_worker.rb
Ruby
mit
8,966
main
694
# frozen_string_literal: true class LogSendgridEventWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low def perform(params) events = params["_json"] # Handling potential SendGrid weirdness where sometimes it might not give us an array. events = [events] unless events.is_a?(Array) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/execute_scheduled_payouts_job.rb
Ruby
mit
8,966
main
625
# frozen_string_literal: true class ExecuteScheduledPayoutsJob include Sidekiq::Job sidekiq_options retry: 1, queue: :low, lock: :until_executed def perform Rails.logger.info("ExecuteScheduledPayoutsJob: Started") ScheduledPayout.due.find_each do |scheduled_payout| scheduled_payout.execute! r...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_financial_reports_for_previous_quarter_job.rb
Ruby
mit
8,966
main
811
# frozen_string_literal: true class GenerateFinancialReportsForPreviousQuarterJob include Sidekiq::Job sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace def perform return unless Rails.env.production? quarter_start_date = Date.current.prev_quarter.beginning_of_quar...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/update_tax_rates_job.rb
Ruby
mit
8,966
main
4,866
# frozen_string_literal: true class UpdateTaxRatesJob include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform summary_rates = client.summary_rates summary_rates.select { |summary_rate| Compliance::Countries::EU_VAT_APPLICABLE_COUNTRY_CODES.include?(summary_rate.country_code) || tax_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/generate_large_sellers_analytics_cache_worker.rb
Ruby
mit
8,966
main
425
# frozen_string_literal: true class GenerateLargeSellersAnalyticsCacheWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :low, lock: :until_executed def perform User.joins(:large_seller).find_each do |user| CreatorAnalytics::CachingProxy.new(user).generate_cache rescue => e ErrorNo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/block_stripe_suspected_fraudulent_payments_worker.rb
Ruby
mit
8,966
main
1,613
# frozen_string_literal: true class BlockStripeSuspectedFraudulentPaymentsWorker include Sidekiq::Job sidekiq_options retry: 3, queue: :low TRAILING_DAYS = 90 STRIPE_EMAIL_SENDER = "notifications@stripe.com" HELPER_NOTE_CONTENT = "Done with code" POSSIBLE_CONVERSATION_SUBJECTS = [ "Suspected fraudulen...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/attach_past_purchases_to_user_worker.rb
Ruby
mit
8,966
main
387
# frozen_string_literal: true class AttachPastPurchasesToUserWorker include Sidekiq::Job sidekiq_options retry: 3, queue: :default def perform(user_id) user = User.find(user_id) return if user.email.blank? Purchase.where(email: user.email, purchaser_id: nil).find_each do |past_purchase| past_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/schedule_workflow_emails_worker.rb
Ruby
mit
8,966
main
249
# frozen_string_literal: true class ScheduleWorkflowEmailsWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :default def perform(purchase_id) purchase = Purchase.find(purchase_id) purchase.schedule_all_workflows end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/expiring_credit_card_message_worker.rb
Ruby
mit
8,966
main
956
# frozen_string_literal: true class ExpiringCreditCardMessageWorker include Sidekiq::Job sidekiq_options retry: 1, queue: :default # Selects all the credit cards that expire next month and notifies the customers to update them. # There are 2 types of emails that we send to users: # - emails that specify the...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/perform_daily_instant_payouts_worker.rb
Ruby
mit
8,966
main
505
# frozen_string_literal: true class PerformDailyInstantPayoutsWorker include Sidekiq::Job sidekiq_options retry: 0, queue: :critical, lock: :until_executed def perform payout_period_end_date = Date.yesterday Rails.logger.info("AUTOMATED DAILY INSTANT PAYOUTS: #{payout_period_end_date} (Started)") ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/exports/audience_export_worker.rb
Ruby
mit
8,966
main
542
# frozen_string_literal: true class Exports::AudienceExportWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(seller_id, recipient_id, audience_options = {}) seller, recipient = User.find(seller_id, recipient_id) recipient ||= seller result = Export...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/exports/affiliate_export_worker.rb
Ruby
mit
8,966
main
501
# frozen_string_literal: true class Exports::AffiliateExportWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(seller_id, recipient_id) seller, recipient = User.find(seller_id, recipient_id) recipient ||= seller result = Exports::AffiliateExportServ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/exports/sales/compile_chunks_worker.rb
Ruby
mit
8,966
main
1,339
# frozen_string_literal: true class Exports::Sales::CompileChunksWorker include Sidekiq::Job # This job is unique because two parallel ProcessChunkWorker jobs could queue this at the same time. sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(export_id) @export = SalesExport.find(e...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/exports/sales/create_and_enqueue_chunks_worker.rb
Ruby
mit
8,966
main
1,575
# frozen_string_literal: true class Exports::Sales::CreateAndEnqueueChunksWorker include Sidekiq::Job sidekiq_options retry: 5, queue: :low # This is the number of purchases that will be exported in each SalesExportChunk. # It also affects: # - how long it will take to serialize/deserialize that YAML (2.5s/0...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/exports/sales/process_chunk_worker.rb
Ruby
mit
8,966
main
1,524
# frozen_string_literal: true class Exports::Sales::ProcessChunkWorker include Sidekiq::Job # This job is unique because two parallel jobs running `chunks_left_to_process?` could queue the same chunk to be reprocessed. sidekiq_options retry: 5, queue: :low, lock: :until_executed def perform(chunk_id) @chu...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/reports/generate_ytd_sales_report_job.rb
Ruby
mit
8,966
main
3,578
# frozen_string_literal: true module Reports class GenerateYtdSalesReportJob include Sidekiq::Worker sidekiq_options queue: "low", retry: 3 def perform current_year_start = Time.current.beginning_of_year.iso8601 es_query = { size: 0, query: { bool: { fi...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/sidekiq/concerns/transcode_event_handler.rb
Ruby
mit
8,966
main
1,156
# frozen_string_literal: true module TranscodeEventHandler private def handle_transcoding_job_notification(job_id, state, transcoded_video_key = nil) transcoded_video_from_job = TranscodedVideo.find_by(job_id:) return if transcoded_video_from_job.nil? TranscodedVideo.processing.where(original_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/controllers/purchases_controller.rb
Ruby
mit
8,966
main
15,872
# frozen_string_literal: true class PurchasesController < ApplicationController include CurrencyHelper, PreorderHelper, RecommendationType, ValidateRecaptcha, ProcessRefund include Order::ResponseHelpers SEARCH_RESULTS_PER_PAGE = 100 PARAM_TO_ATTRIBUTE_MAPPINGS = { friend: :friend_actions, plugins: :p...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/controllers/embedded_javascripts_controller.rb
Ruby
mit
8,966
main
471
# frozen_string_literal: true class EmbeddedJavascriptsController < ApplicationController skip_before_action :verify_authenticity_token, only: %i[overlay embed] def overlay @script_path = Shakapacker.manifest.lookup!("overlay.js") @global_stylesheet_path = Shakapacker.manifest.lookup!("design.css") @s...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/controllers/bundles_controller.rb
Ruby
mit
8,966
main
1,175
# frozen_string_literal: true class BundlesController < Sellers::BaseController include Product::BundlesMarketing def show bundle = Link.can_be_bundle.find_by_external_id!(params[:id]) authorize bundle redirect_to edit_bundle_product_path(bundle.external_id), status: :moved_permanently end def c...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/controllers/subscriptions_controller.rb
Ruby
mit
8,966
main
3,429
# frozen_string_literal: true class SubscriptionsController < ApplicationController include PageMeta::Product PUBLIC_ACTIONS = %i[manage unsubscribe_by_user].freeze before_action :authenticate_user!, except: PUBLIC_ACTIONS after_action :verify_authorized, except: PUBLIC_ACTIONS before_action :fetch_subscri...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/controllers/product_files_utility_controller.rb
Ruby
mit
8,966
main
2,223
# frozen_string_literal: true class ProductFilesUtilityController < ApplicationController include SignedUrlHelper before_action :authenticate_user! before_action :set_product, only: %i[download_product_files download_folder_archive] def external_link_title response = SsrfFilter.get(params.require(:url))...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/controllers/churn_controller.rb
Ruby
mit
8,966
main
621
# frozen_string_literal: true class ChurnController < Sellers::BaseController layout "inertia" before_action :check_payment_details def show authorize :churn LargeSeller.create_if_warranted(current_seller) service = CreatorAnalytics::Churn.new(seller: current_seller) start_date = parse_date(...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/controllers/stripe_account_sessions_controller.rb
Ruby
mit
8,966
main
1,544
# frozen_string_literal: true class StripeAccountSessionsController < Sellers::BaseController before_action :authorize def create connected_account_id = current_seller.stripe_account&.charge_processor_merchant_id if connected_account_id.blank? return render json: { success: false, error_message: "Us...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/controllers/library_controller.rb
Ruby
mit
8,966
main
2,041
# frozen_string_literal: true class LibraryController < Sellers::BaseController layout "inertia" skip_before_action :check_suspended before_action :check_user_confirmed, only: [:index] before_action :set_purchase, only: [:archive, :unarchive, :delete] RESEND_CONFIRMATION_EMAIL_TIME_LIMIT = 24.hours priv...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/controllers/emails_controller.rb
Ruby
mit
8,966
main
4,752
# frozen_string_literal: true class EmailsController < Sellers::BaseController layout "inertia" before_action :set_installment, only: %i[edit update destroy] def index authorize Installment if current_seller.installments.alive.not_workflow_installment.scheduled.exists? redirect_to scheduled_emai...