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

feature: new JOBS API #142

Merged
merged 11 commits into from
Jul 3, 2024
Merged

feature: new JOBS API #142

merged 11 commits into from
Jul 3, 2024

Conversation

rustatian
Copy link
Member

@rustatian rustatian commented Jun 26, 2024

Reason for This PR

ref: roadrunner-server/roadrunner#1941

Description of Changes

  • Support NackWithOptions method.
  • Remove all in-flight messages on the pipeline stop.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT license.

PR Checklist

[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

Summary by CodeRabbit

  • New Features

    • Updated various dependencies and packages to the latest versions, improving reliability and performance.
  • Bug Fixes

    • Adjusted delay field types and method signatures to enhance functionality and prevent potential issues.
  • Tests

    • Enhanced test configurations and dependencies to ensure compatibility with updated packages.
  • Chores

    • Upgraded package import paths to maintain coherence with the latest versions.

Signed-off-by: Valery Piashchynski <[email protected]>
Signed-off-by: Valery Piashchynski <[email protected]>
Signed-off-by: Valery Piashchynski <[email protected]>
@rustatian rustatian added the enhancement New feature or request label Jun 26, 2024
@rustatian rustatian requested a review from wolfy-j June 26, 2024 12:24
@rustatian rustatian self-assigned this Jun 26, 2024
Copy link

coderabbitai bot commented Jun 26, 2024

Walkthrough

This update primarily involves version upgrades and type modifications across various components of the RoadRunner server, focusing on transitioning from version 4 to version 5 for multiple dependencies and improving the type handling for specific configurations and methods. The changes enhance compatibility, update dependencies, and refine type consistency within the system.

Changes

Files / Paths Change Summary
amqpjobs/driver.go, plugin.go Updated jobs package import from v3 to v4.
amqpjobs/item.go Introduced "maps" import, updated jobs package version, and adjusted Delay from int64 to int.
amqpjobs/config.go Renamed comment to ClientAuthType TSL auth type for ClientAuthType declaration.
go.mod Upgraded roadrunner-server/api/v4 from v4.12.0 to v4.15.0 and various OpenTelemetry dependencies.
tests/go.mod Updated versions for multiple github.com/roadrunner-server packages, e.g., api, informer, jobs.
tests/jobs_amqp_durability_test.go Updated amqpDriver package from v4 to v5.
tests/jobs_amqp_test.go Updated Version field in config.Plugin from "2.12.2" to "2024.1.0".
tests/pkgs.txt Updated versions from v4 to v5 for multiple github.com/roadrunner-server modules.

Poem

In the code where changes thrive,
Versions jump from four to five.
Fields and types now realigned,
Delay as int, I do not mind.
Dependencies in a shiny new state,
For RoadRunner's journey to innovate.

~ 🐇✨

Tip

AI model upgrade

gpt-4o model for reviews and chat is now live

OpenAI claims that this model is better at understanding and generating code than the previous models. Please join our Discord Community to provide any feedback or to report any issues.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between df3105d and 1981cb5.

Files ignored due to path filters (4)
  • go.sum is excluded by !**/*.sum
  • go.work.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
  • tests/php_test_files/composer.lock is excluded by !**/*.lock
Files selected for processing (21)
  • .githooks/pre-commit (1 hunks)
  • .github/workflows/linters.yml (1 hunks)
  • .github/workflows/linux.yml (2 hunks)
  • .github/workflows/linux_durability.yml (2 hunks)
  • .gitignore (1 hunks)
  • .golangci.yml (3 hunks)
  • amqpjobs/driver.go (1 hunks)
  • amqpjobs/item.go (8 hunks)
  • githooks-installer.sh (1 hunks)
  • go.mod (1 hunks)
  • plugin.go (1 hunks)
  • tests/go.mod (2 hunks)
  • tests/jobs_amqp_test.go (6 hunks)
  • tests/php_test_files/jobs/jobs_create_memory.php (1 hunks)
  • tests/php_test_files/jobs/jobs_err.php (1 hunks)
  • tests/php_test_files/jobs/jobs_ok.php (1 hunks)
  • tests/php_test_files/jobs/jobs_ok_pq.php (1 hunks)
  • tests/php_test_files/jobs/jobs_ok_queue_name_exist.php (1 hunks)
  • tests/php_test_files/jobs/jobs_ok_sleep1.php (1 hunks)
  • tests/php_test_files/jobs/jobs_ok_slow.php (1 hunks)
  • tests/php_test_files/jobs/jobs_ok_slow_rand.php (2 hunks)
Files skipped from review due to trivial changes (14)
  • .githooks/pre-commit
  • .github/workflows/linters.yml
  • .github/workflows/linux.yml
  • .gitignore
  • .golangci.yml
  • githooks-installer.sh
  • go.mod
  • tests/go.mod
  • tests/jobs_amqp_test.go
  • tests/php_test_files/jobs/jobs_create_memory.php
  • tests/php_test_files/jobs/jobs_ok_queue_name_exist.php
  • tests/php_test_files/jobs/jobs_ok_sleep1.php
  • tests/php_test_files/jobs/jobs_ok_slow.php
  • tests/php_test_files/jobs/jobs_ok_slow_rand.php
Additional comments not posted (18)
tests/php_test_files/jobs/jobs_ok.php (3)

13-13: Consistent use of double quotes for string literals.


20-20: Updated method call to ack().

This change aligns with the PR's objective to standardize task acknowledgment methods across the codebase.


22-22: Proper error logging.

Using the error method to log exceptions is a good practice, ensuring that all errors are captured and logged appropriately.

tests/php_test_files/jobs/jobs_ok_pq.php (4)

13-13: Consistent use of double quotes for string literals.


20-20: Introduce simulated delay using sleep(15).

Consider adding a comment explaining the purpose of this delay if it's specifically for testing scenarios.


21-21: Updated method call to ack().

This change aligns with the PR's objective to standardize task acknowledgment methods across the codebase.
[APPROved]


23-23: Proper error logging.

Using the error method to log exceptions is a good practice, ensuring that all errors are captured and logged appropriately.

tests/php_test_files/jobs/jobs_err.php (3)

13-13: Consistent use of double quotes for string literals.


21-21: Introduced retry logic with delay.

This robust pattern allows tasks to be retried with a delay, improving the resilience of the job handling system.

Also applies to: 26-29


32-32: Proper error logging.

Using the error method to log exceptions is a good practice, ensuring that all errors are captured and logged appropriately.

plugin.go (1)

6-6: Updated import paths to reflect new API version.

This change is necessary to align with the updated version of the jobs API, ensuring compatibility.

.github/workflows/linux_durability.yml (1)

20-22: Updated testing matrix to use the latest versions.

Updating the PHP, Go, and OS versions in the matrix ensures that the tests are run against the latest environments, which is crucial for maintaining compatibility and catching potential issues early.

amqpjobs/item.go (5)

6-6: Approved: Import adjustments and namespace changes.

The addition of "maps" and update to the jobs package version are aligned with the changes described in the PR summary and AI-generated summaries, indicating an API upgrade.

Also applies to: 13-13


45-45: Approved: Change of Delay field type.

Changing the Delay field from int64 to int simplifies interactions and is consistent with the method adjustments in the same file.


135-152: Approved: Enhancements to NackWithOptions method.

The method now supports conditional requeueing with or without delay, enhancing its flexibility in job handling. The implementation logic correctly handles different scenarios based on the requeue and delay parameters.


Line range hint 165-193: Approved: Updates to Requeue method.

The method now accepts an int for the delay, aligning with other changes in the file. The use of the maps.Copy function to manage headers during requeueing is a robust enhancement, ensuring headers are correctly transferred or merged.


244-244: Approved: Consistent type casting in fromJob method.

The casting of the Delay field to int is consistent with its new declaration in the Options struct, ensuring type safety and alignment across the application.

amqpjobs/driver.go (1)

16-16: Approved: Namespace update in import statement.

The update to the jobs package version aligns with the changes described in the PR summary and AI-generated summaries, indicating an API upgrade.

Signed-off-by: Valery Piashchynski <[email protected]>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1981cb5 and 7f09a37.

Files selected for processing (1)
  • amqpjobs/item.go (8 hunks)
Files skipped from review as they are similar to previous changes (1)
  • amqpjobs/item.go

Signed-off-by: Valery Piashchynski <[email protected]>
Signed-off-by: Valery Piashchynski <[email protected]>
@rustatian rustatian marked this pull request as draft July 3, 2024 10:58
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7f09a37 and 707d09d.

Files ignored due to path filters (4)
  • go.sum is excluded by !**/*.sum
  • go.work is excluded by !**/*.work
  • go.work.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
Files selected for processing (8)
  • amqpjobs/driver.go (9 hunks)
  • amqpjobs/listener.go (1 hunks)
  • amqpjobs/redial.go (3 hunks)
  • go.mod (2 hunks)
  • plugin.go (3 hunks)
  • tests/go.mod (4 hunks)
  • tests/jobs_amqp_test.go (7 hunks)
  • tests/php_test_files/jobs/jobs_err.php (1 hunks)
Files skipped from review due to trivial changes (1)
  • amqpjobs/listener.go
Files skipped from review as they are similar to previous changes (5)
  • amqpjobs/driver.go
  • plugin.go
  • tests/go.mod
  • tests/jobs_amqp_test.go
  • tests/php_test_files/jobs/jobs_err.php
Additional comments not posted (4)
go.mod (2)

10-18: LGTM! Dependency updates are approved.

The updates to github.com/roadrunner-server/api/v4 and other related packages look good.


3-3: Verify Go version compatibility.

Ensure that Go 1.22.5 is compatible with the project's requirements and all dependencies.

Verification successful

Verify Go version compatibility.

The Go version 1.22.5 is consistently specified across the project's configuration files (go.mod, go.work, tests/go.mod), indicating intended compatibility. No issues were found related to this version update.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify Go version compatibility.

# Test: Check the current Go version and ensure compatibility with the project.
go version

Length of output: 82



Script:

#!/bin/bash
# Search for Go version requirements in the project documentation and configuration files
rg -i 'go\s+1\.\d+' README.md docs/ .github/

# Check the go.mod file for any version constraints
rg -i 'go\s+1\.\d+' go.mod

Length of output: 131



Script:

#!/bin/bash
# Search for issues, pull requests, or discussions mentioning Go version 1.22.5
gh issue list --search "Go 1.22.5"
gh pr list --search "Go 1.22.5"
gh discussion list --search "Go 1.22.5"

Length of output: 467



Script:

#!/bin/bash
# Search the entire codebase for any references to Go versions
rg -i 'go\s+1\.\d+'

Length of output: 79

amqpjobs/redial.go (2)

15-16: LGTM! New constant restartStr is approved.

The addition of the restartStr constant for pipeline operation is approved.


325-327: Verify event dispatch for pipeline recreation.

Ensure that the event dispatch to recreate the pipeline upon backoff operation failure is functioning correctly.

@rustatian rustatian marked this pull request as ready for review July 3, 2024 22:04
@rustatian rustatian merged commit a3562d7 into master Jul 3, 2024
6 of 8 checks passed
@rustatian rustatian deleted the feature/new-api branch July 3, 2024 22:07
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 707d09d and 20c3d6f.

Files ignored due to path filters (3)
  • go.sum is excluded by !**/*.sum
  • go.work.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
Files selected for processing (9)
  • amqpjobs/config.go (1 hunks)
  • amqpjobs/driver.go (10 hunks)
  • amqpjobs/item.go (10 hunks)
  • go.mod (2 hunks)
  • plugin.go (3 hunks)
  • tests/go.mod (4 hunks)
  • tests/jobs_amqp_durability_test.go (1 hunks)
  • tests/jobs_amqp_test.go (8 hunks)
  • tests/pkgs.txt (1 hunks)
Files skipped from review due to trivial changes (2)
  • amqpjobs/config.go
  • tests/jobs_amqp_durability_test.go
Files skipped from review as they are similar to previous changes (6)
  • amqpjobs/driver.go
  • amqpjobs/item.go
  • go.mod
  • plugin.go
  • tests/go.mod
  • tests/jobs_amqp_test.go
Additional comments not posted (1)
tests/pkgs.txt (1)

1-1: LGTM! Verify the correctness of the updated paths.

The import paths for various roadrunner-server modules have been correctly updated to v5.

However, ensure that all updated paths are valid and correctly referenced in the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant