title: How to make WorkManager.cancel() immediate?
body: <p>I have duplicated data backednd side due to the fact that WorkManager.cancel() isn't immediate.</p>
  <p>I tried to maked the cancellation immediate by making it a Single. but it doesn't work.</p>
  <pre><code>private fun cancelSendEventsWorkManager(): Single&lt;Boolean&gt; =
              Single.fromCallable {
                  WorkManager.getInstance(requireContext()).getWorkInfosByTag(SendEventstWorker.TAG).cancel(true)
              }.subscribeOn(Schedulers.io())
  </code></pre>
  <p>and use it like this on a <em>click button event</em> :</p>
  <pre><code>Single.concat(
                                  cancelSendEventsWorkManager(),
                                  eventsViewModel.reportAllEvents(),
                                  eventsViewModel.saveReportCompleted(),
  
  .subscribeOn(Schedulers.io())
                      .doOnSubscribe {
                          EventBus.post(ShowProgress(getString(R.string.common_dialog_progress_generic)))
                      }
                      .doOnError {
                          EventBus.post(DismissProgress())
                          listener?.showUnknownErrorDialog()
                      }
                      .doOnComplete {
                          onReportAllEventAndCloseSessionSuccess(userName)
                      }
                      .subscribe(
                              {
                              }, {
                              onReportAllEventAndCloseSessionSuccess(userName)
                          }
                      })
  </code></pre>
  <p><strong>SendEventstWorker</strong></p>
  <pre><code>class SendEventstWorker constructor(context: Context, workerParameters: WorkerParameters) : RxWorker(context, workerParameters) {
     
  
      private val db: RpxDatabase = RpxDatabase.getInstance(context)
      private val eventRepository: EventRepository
  
      init {
          eventRepository = db.eventRepository
      }
  
      override fun createWork(): Single&lt;Result&gt; {
          // Get the input
          val userId = inputData.getString(KEY_USER_ID)
  
          return eventsRepository
                  .getAllventsByUserId(userId)
                  .flattenAsObservable {
                      Log.d(TAG, it.size.toString())
                      it
                  }
                  .concatMapSingle {
                      val event = it
  
  
                      val mapper = ObjectMapper()
                      val typeRef: TypeReference&lt;HashMap&lt;String, Any&gt;&gt; = object : TypeReference&lt;HashMap&lt;String, Any&gt;&gt;() {}
                      val map: Map&lt;String, Any&gt; = mapper.readValue(Event.data, typeRef)
  
  
                      reportingApi.reportEvent(e.eventventType.getValue(), event.id,
                              event.eventCreateDate, event.bId, event.bHash,
                              map)
                              .subscribeOn(Schedulers.io())
                              .observeOn(Schedulers.io())
                              .doOnSuccess {
                                  deleteEvent(event)
                              }
                              .doOnError {
  
                              }
                  }
                  .toList()
                  //.subscribeOn(Schedulers.io())
                  .map { Result.retry() }
                      .onErrorReturn {
                      Result.retry()
                  }
      }
  
  
      private fun deleteEvent(event: Event) {
          Single.fromCallable { eventRepository.deleteEvent(event) }
                  .subscribeOn(Schedulers.io())
                  .subscribe()
      }
  }
  </code></pre>
  <p>Is there any way to acheive the immediate cancelation properly ?</p>