background_job.rb 728 B

123456789101112131415161718192021222324252627282930
  1. class Transaction::BackgroundJob
  2. def initialize(item, params = {})
  3. =begin
  4. {
  5. object: 'Ticket',
  6. type: 'update',
  7. ticket_id: 123,
  8. interface_handle: 'application_server', # application_server|websocket|scheduler
  9. changes: {
  10. 'attribute1' => [before,now],
  11. 'attribute2' => [before,now],
  12. },
  13. created_at: Time.zone.now,
  14. user_id: 123,
  15. },
  16. =end
  17. @item = item
  18. @params = params
  19. end
  20. def perform
  21. if Gem::Version.new(Version.get) >= Gem::Version.new('4.0.x')
  22. ActiveSupport::Deprecation.warn("This file has been migrated to the ActiveJob 'TransactionJob' and is therefore deprecated and should get removed.")
  23. end
  24. TransactionJob.perform_now(@item, @params)
  25. end
  26. end