title: How to run WorkManager's work retry every 5 seconds
body: <p>How to retry work with every 5 seconds?
  And if was successful then cancel it?</p>
  
  <p>With the solution below it runs every 10 seconds + Linear growth of time.</p>
  
  <pre><code>// todo: schedule, and invoke worker every 5 seconds
  // todo: if the work is done and there is no more work in queue - cancel worker.
  
  fun scheduleBatchUpload(uniqueWorkName: String) {
      val logBuilder = PeriodicWorkRequest.Builder(StreamLogWorker::class.java, 5, TimeUnit.SECONDS)
  
      logBuilder.setBackoffCriteria(BackoffPolicy.LINEAR, 5000, TimeUnit.MILLISECONDS) // Custom retry not working
  
      WorkManager.getInstance().enqueueUniquePeriodicWork(uniqueWorkName, ExistingPeriodicWorkPolicy.REPLACE, logBuilder.build())
  }
  
  
  class StreamLogWorker(context: Context, workerParams: WorkerParameters) : Worker(context, workerParams) {
  
      override fun doWork(): Result {
          Log.e("!!!!!!!!!!", "doWork")
          return Result.retry()
      }
  }
  </code></pre>