You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: charges_worker.rb
    path of file: ./repos/baremetrics-v1/app/workers
    
    the code of the file until where you have to start completion: class ChargesWorker
  include Sidekiq::Worker

  def perform(account_id, update = false, queue_name)
    account = Account.find(account
    
  def perform(account_id, update = false, queue_name)
    account = Account.find(account_id)
    api_key = account.stripe_access_token

    if update == true
      total_charges = Stripe::Charge.all({created: { gte: 7.days.ago.to_i }}, api_key).count

      if Stripe::Charge.all({created: { gte: 7.days.ago.to_i }, offset: total_charges-1, count:1}, api_key).first.present?
        start_date = Time.at(Stripe::Charge.all({created: { gte: 7.days.ago.to_i }, offset: total_charges-1, count:1}, api_key).first.created).to_datetime.to_date
      else
        start_date = Time.at(7.days.ago.to_i).to_datetime.to_date
      end