Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle task failure and fix task duplication #588

Merged
merged 5 commits into from
Jul 6, 2020
Merged

Conversation

dominik-zeglen
Copy link
Contributor

I want to merge this change because it fixes a few things:

  1. Tasks were duplicated when queued
  2. Tasks were never finished - although they had success status, they were still executed
  3. Tasks that failed on the backend side can now handled

PR intended to be tested with API branch: master

Screenshots

Pull Request Checklist

  1. All visible strings are translated with proper context.
  2. All data-formatting is locale-aware (dates, numbers, and so on).
  3. Translated strings are extracted.
  4. Number of API calls is optimized.
  5. The changes are tested.
  6. Type definitions are up to date.
  7. Changes are mentioned in the changelog.


import BackgroundTasksContext from "./context";
import { handleTask, queueCustom } from "./tasks";
import { QueuedTask, Task, TaskData, TaskStatus } from "./types";

export const backgroundTasksRefreshTime = 15 * 1000;

export function useBackgroundTasks() {
// TODO: Remove underscores when these arguments would be finally useful
Copy link
Contributor

@orzechdev orzechdev Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? What does it mean useful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like, uh, #575

Copy link
Member

@krzysztofwolski krzysztofwolski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider changing task names in test to make them easier to read.
Besides that 👍

@dominik-zeglen dominik-zeglen merged commit 9a7c855 into master Jul 6, 2020
@dominik-zeglen dominik-zeglen deleted the fix/task-queue branch July 6, 2020 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants