Sha256: 898fd5888366ae27ff85494f07bb7aa10cec6da3773126a8e2602556496cb9bc

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

# typed: true

module UpGush
  module Jobs
    class ScheduleCleanup < Gush::Job
      # The workflow is finished when all its jobs are finished.
      # Deleting the workflow at this moment, will leave in redis the current job, all alone.
      def allowed_to_execute?
        true
      end

      def perform
        # let's keep this job to be the last one to execute so we can update the workflow status to :finished
        up_workflow = UpGush::Models::Workflow.find_by(redis_workflow_id: workflow_id)
        return if !up_workflow || up_workflow.save_in_db?

        DeleteWorkflowFromRedis.perform_in(30.seconds, workflow_id)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
up_gush-3.0.0.1 lib/up_gush/jobs/schedule_cleanup.rb