forked from GitHub-Mirror/riotX-android
Add comment to explain why we use a AlwaysSuccessfulWorker
This commit is contained in:
parent
15c4b03340
commit
4009f2c176
@ -38,6 +38,7 @@ import im.vector.matrix.android.internal.database.query.where
|
|||||||
import im.vector.matrix.android.internal.session.content.UploadContentWorker
|
import im.vector.matrix.android.internal.session.content.UploadContentWorker
|
||||||
import im.vector.matrix.android.internal.session.room.timeline.TimelineSendEventWorkCommon
|
import im.vector.matrix.android.internal.session.room.timeline.TimelineSendEventWorkCommon
|
||||||
import im.vector.matrix.android.internal.util.CancelableWork
|
import im.vector.matrix.android.internal.util.CancelableWork
|
||||||
|
import im.vector.matrix.android.internal.worker.AlwaysSuccessfulWorker
|
||||||
import im.vector.matrix.android.internal.worker.WorkManagerUtil
|
import im.vector.matrix.android.internal.worker.WorkManagerUtil
|
||||||
import im.vector.matrix.android.internal.worker.WorkManagerUtil.matrixOneTimeWorkRequestBuilder
|
import im.vector.matrix.android.internal.worker.WorkManagerUtil.matrixOneTimeWorkRequestBuilder
|
||||||
import im.vector.matrix.android.internal.worker.WorkerParamsFactory
|
import im.vector.matrix.android.internal.worker.WorkerParamsFactory
|
||||||
@ -163,8 +164,8 @@ internal class DefaultSendService @Inject constructor(private val context: Conte
|
|||||||
TimelineSendEventWorkCommon.cancelAllWorks(context, roomId)
|
TimelineSendEventWorkCommon.cancelAllWorks(context, roomId)
|
||||||
WorkManager.getInstance(context).cancelUniqueWork(buildWorkName(UPLOAD_WORK))
|
WorkManager.getInstance(context).cancelUniqueWork(buildWorkName(UPLOAD_WORK))
|
||||||
|
|
||||||
// TODO Valere: what is the aim of this code ? Cancellation above is not enough?
|
// Replace the worker chains with a AlwaysSuccessfulWorker, to ensure the queues are well emptied
|
||||||
matrixOneTimeWorkRequestBuilder<FakeSendWorker>()
|
matrixOneTimeWorkRequestBuilder<AlwaysSuccessfulWorker>()
|
||||||
.build().let {
|
.build().let {
|
||||||
TimelineSendEventWorkCommon.postWork(context, roomId, it, ExistingWorkPolicy.REPLACE)
|
TimelineSendEventWorkCommon.postWork(context, roomId, it, ExistingWorkPolicy.REPLACE)
|
||||||
|
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package im.vector.matrix.android.internal.session.room.send
|
package im.vector.matrix.android.internal.worker
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.Worker
|
import androidx.work.Worker
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
|
|
||||||
internal class FakeSendWorker(context: Context, params: WorkerParameters)
|
internal class AlwaysSuccessfulWorker(context: Context, params: WorkerParameters)
|
||||||
: Worker(context, params) {
|
: Worker(context, params) {
|
||||||
|
|
||||||
override fun doWork(): Result {
|
override fun doWork(): Result {
|
Loading…
Reference in New Issue
Block a user