https://github.com/pluginaweek/state_machineを使用しています
私のコードは
event :set_running do
transition any => :runnning
end
event :restart do
transition :failed => :restarting
end
after_transition :failed => :restarting do |job,transition|
job.set_running
end
after_transition :restarting => :running do |job,transition|
job.restart_servers
=begin
this takes some time. and i would like job state to be "restarting" while
it's restarting servers. but it doesn't happen (i suppose because of transaction)
until after_transition :failed => :restarting callback is finished.
so it actually doesnt happen at all because this callback triggers => :running transition
=end
end
つまり、「restart」イベントを1回実行し、:failedから:runningへの転送中に中間遷移をトリガーしたいと思います。どういうわけかstate_machineを使用してそれを行うことができますか?