deadlock detected with capybara-webkit

后端 未结 4 710
梦谈多话
梦谈多话 2021-02-09 12:04

I\'m trying to pass this spec :

scenario \"Edit a service\", js: true do
  service = create_service_for(provider, title: \"First service\")
  fill_edit_service_f         


        
4条回答
  •  孤城傲影
    2021-02-09 12:22

    I was having different tests fail randomly (like 1 test out of 500, every other time I ran the suite).

    This may not be the prettiest solution, but I solved the problem by just rescuing and retrying the database cleaner after 2 seconds, like so:

    config.after(:each) do |example|
      begin
        DatabaseCleaner.clean
      rescue Exception => e
        # Recover from thread locks and retry the database clean after a slight delay
        sleep 2
        DatabaseCleaner.clean
      end
    end
    

提交回复
热议问题