我的rails应用程序中有一个Job,它来自ActiveJob :: Base,有两种方式可以调用:
我是否有办法在工作中确定Resque工作人员是否正在处理它?</ p>
答案 0 :(得分:0)
您应该在服务器日志中看到对ActiveJob
的引用。
[ActiveJob] [<YOUR-JOB-CLASS>] [b8ed2ecb-10ce-433d-8ddb-33a04c8021cd] Performing <YOUR-JOB-CLASS> from Resque(default)...
这不是决定性的,但它是执行代码的上下文中的一个强有力的指标。
答案 1 :(得分:0)
您可以使用 NSNotificationCenter.defaultCenter().addObserver(self, selector: "playerWillAppear:", name: "PlayerWillAppear", object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "playerWillDisappear:", name: "PlayerWillDisappear", object: nil)
func playerWillAppear(notification: NSNotification) {
print("A Player will be opened now")
}
func playerWillDisappear(notification: NSNotification) {
print("A Player will be closed now")
}
来确定您是否在Rails应用程序内,或者您是否处于Resque环境中。