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

configure job connections #323

Merged
merged 4 commits into from
Sep 24, 2024
Merged

Conversation

abhihyder
Copy link
Contributor

Add Job Connections Configuration

Summary

This pull request introduces a new configuration option for setting specific job connections for webhooks, scripttags, and after_authenticate_job.

Details

  • Job Connections Configuration: Added a new job_connections array in the configuration file to allow setting custom job connections for:
    • Webhooks
    • Scripttags
    • After Authenticate Job

This change allows developers to define separate job connections for each of these features, enabling better control and customization of their job handling process.

'job_connections' => [
    'webhooks' => env('WEBHOOKS_JOB_CONNECTION', null),
    'scripttags' => env('SCRIPTTAGS_JOB_CONNECTION', null),
    'after_authenticate' => env('AFTER_AUTHENTICATE_JOB_CONNECTION', null),
],

Environment Variables

To utilize the new job connections, the following environment variables can be set:

  • WEBHOOKS_JOB_CONNECTION
  • SCRIPTTAGS_JOB_CONNECTION
  • AFTER_AUTHENTICATE_JOB_CONNECTION

If these variables are not set, the default job connection will be used.

Benefits

  • Improved flexibility in handling different job types.
  • Enhanced ability to manage and scale job processing according to specific needs.

@Kyon147
Copy link
Owner

Kyon147 commented Jul 16, 2024

Thanks for submitting the PR. I'll review it and let you know if I have any feedback

@Kyon147
Copy link
Owner

Kyon147 commented Aug 2, 2024

@abhihyder could you add or update the unit tests so that we have this change in coverage?

Copy link
Owner

@Kyon147 Kyon147 left a comment

Choose a reason for hiding this comment

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

The action code looks great, but just wanted to have it covered by the existing unit tests or creating a new test. So we can confirm that the actions are executed on the correct connection.

@abhihyder
Copy link
Contributor Author

Hi @Kyon147, Thank you for the feedback!

I've updated the existing unit tests to cover the changes related to job dispatching on the correct connection. Specifically, I've added tests to ensure that the actions in AfterAuthorize, DispatchScripts, DispatchWebhooks, and the WebhookController trait are executed on the appropriate custom connection as defined in the configuration.

You can run the test cases with the following commands:

  • ./vendor/bin/phpunit tests/Actions/AfterAuthorizeTest.php
  • ./vendor/bin/phpunit tests/Actions/DispatchScriptsTest.php
  • ./vendor/bin/phpunit tests/Actions/DispatchWebhooksTest.php
  • ./vendor/bin/phpunit tests/Traits/WebhookControllerTest.php

@Kyon147
Copy link
Owner

Kyon147 commented Sep 24, 2024

Hey @abhihyder

I've fixed the lint issue and will get this out in the next release. Thanks for the PR 👍

@Kyon147 Kyon147 merged commit 61ad790 into Kyon147:master Sep 24, 2024
6 checks passed
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