Skip to content

PG::TRSerializationFailure (PG::InFailedSqlTransaction: ERROR) #100

@SpaceKun

Description

@SpaceKun

Hi, unfortunately while using your gem I encountered this error: (PG::TRSerializationFailure: ERROR: could not serialize access due to concurrent update), Could you help me with this problem?
After finish all collection of ArrayJob, I get this error at periodicity
Thanks for your help.

PostgreSQL 14.13
ruby 3.1.2
'rails', '~> 7.0'
'acidic_job'
# frozen_string_literal: true

class TestJob < AcidicJob::Base
  queue_as :imports

  def perform(import_id)
    puts "Start TestJob for import_process_id: #{import_id} PERFORM".yellow

    with_acidic_workflow persisting: { import_id: } do |workflow|
      workflow.step :step_create
      workflow.step :step_prepared, awaits: :prepare
      workflow.step :step_array, awaits: :array
      workflow.step :step_comleted
    end
  end

  private

  def step_create
    puts "Start step_create for import_process_id: #{import_id} prepare".green
  end

  def prepare
    PrepareJob.with(import_id)
  end

  def step_prepared
    puts "Start step_Prepared for import_process_id: #{import_id}".green
  end

  def array
    [1, 2, 3].map do |test|
      puts "number #{test}".purple
      ArrayJob.with(import_id)
    end
  end

  def step_array
    puts "Start step_Array for import_process_id: #{import_id}".green
  end

  def step_comleted
    puts "Start step_Completed for import_process_id: #{import_id}".green
  end
end
# frozen_string_literal: true

class PrepareJob < AcidicJob::Base
  queue_as :imports

  def perform(import_id)
    puts "Start PrepareJob for import_process_id: #{import_id}".blue
  end
end

# frozen_string_literal: true

class ArrayJob < AcidicJob::Base
  queue_as :imports

  def perform(import_id)
    puts "Start ArrayJob for import_process_id: #{import_id}".red
  end
end

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions