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

Cancel Job Route #129

Merged
merged 5 commits into from
May 7, 2024
Merged

Cancel Job Route #129

merged 5 commits into from
May 7, 2024

Conversation

nickscamara
Copy link
Member

closes #106

Notes: Bull doesnt allow to cancel active jobs.

Design decision: we mark the job as failed when someone cancels, and we stop the scraping process (which is the actual expensive process). We bill them as soon as they cancel, even if some promises are not resolved resulting in them getting more from what they paid (totally cool!)

I think this works fairly well for now. @rafaelsideguide would love a look over.

@nickscamara
Copy link
Member Author

I ended up upgrading our fly setup here. Feel free to ignore.

Copy link
Collaborator

@rafaelsideguide rafaelsideguide left a comment

Choose a reason for hiding this comment

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

Introduced a 500 error on /scrape and /search. Also, the cancel test is not passing.

  • E2E Tests for API Routes › POST /v0/scrape › should return a successful response with a valid preview token

    expect(response.statusCode).toBe(200) // Object.is equality

    Expected: 200
    Received: 500

  • E2E Tests for API Routes › POST /v0/scrape › should return a successful response with a valid API key

    expect(response.statusCode).toBe(200)

    Expected: 200
    Received: 500

  • E2E Tests for API Routes › POST /v0/search › should return a successful response with a valid API key

    expect(response.statusCode).toBe(200);

    Expected: 200
    Received: 500

  • E2E Tests for API Routes › If someone cancels a crawl job, it should turn into failed status

    expect(completedResponse.body.partial_data?.length ?? 0).toBeLessThanOrEqual(completedResponse.body.data?.length ?? 0)

    Expected: <= 0
    Received: 40

  • E2E Tests for API Routes › POST /v0/scrape with LLM Extraction › should extract data using LLM extraction mode

    expect(response.statusCode).toBe(200) // Object.is equality

    Expected: 200
    Received: 500

@nickscamara
Copy link
Member Author

Thanks @rafaelsideguide, pushed a fix

@nickscamara
Copy link
Member Author

nickscamara commented May 7, 2024

  • Add to docs

@nickscamara nickscamara merged commit 3459b77 into main May 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] Cancel job route
2 participants