Session problem between Sidekiq and Devise

Asked

Viewed 32 times

0

For some reason after processing Job on Sidekiq a Session falls.

Follow the flow and more detail about the problem.

Fluxo Básico

Follow the code of Job:

class GenerateProfileJob < ApplicationJob
  queue_as :profile

  def perform(login)
    user = User.find_by_login(login)

    import_github(user)
    profile_generate(user)
    #NOTE: Não será enviado email ainda
    # send_profile(user)
    evaluations_count(user)
  end

  def import_github(user)
    Github::Importation.new.run user
  end

  def profile_generate(user)
    Profile::Generate.new(user).run
  end

  def send_profile(user)
    ProfileMailer.with(user: user).evaluation_completed.deliver_now
  end

  def evaluations_count(user)
    user.update(evaluations_count: user.evaluations_count.to_i + 1)
  end
end

In the flow when Redirect occurs everything is normal with Session.

Only after the end of Job processing does Session drop.

Another test I did was to turn Sidekiq off, so Session won’t fall.

Thanks for your help.

  • what is the code of your job? is any job that happens?

  • I will add the Job code in the post and check if it happens to any Job.

  • job may be invalidating the user’s token or invalidating the user.

  • It was the same user, I managed to solve. An old code, you know, pq, update the user’s password, inside the import_github

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.