我有一些用于工作人员的脚本,每次我尝试执行一个特定的工作人员时,它都会执行我拥有的所有脚本工作人员。
这就是我运行脚本工作者的方式:
val stockTakingSync = PeriodicWorkRequest.Builder(
UploadStockTakingSyncWorker::class.java,
interval,
TimeUnit.MILLISECONDS)
.setConstraints(myConstraints)
val stockTakingSyncWork = stockTakingSync.build()
WorkManager.getInstance()?.enqueue(stockTakingSyncWork)
但这是我得到的回报:
07-22 07:35:08.789 1327-1387/com.mockie.daikokuten D/:dump doSync: PrdPriceSyncWorker called
07-22 07:35:08.796 1327-1386/com.mockie.daikokuten D/:dump doSync: PrdSizeWorker called
07-22 07:35:08.803 1327-1388/com.mockie.daikokuten D/:dump doSync: PrdTypeSyncWorker called
07-22 07:35:10.120 1327-1404/com.mockie.daikokuten D/:dump doSync: PrdTypeSyncWorker called
07-22 07:35:10.123 1327-1386/com.mockie.daikokuten D/:dump doSync: PrdSizeWorker called
如您所见,所有工作人员也在执行它。