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

Add env var feature flag to enable queueing library #1004

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

carlpartridge
Copy link
Contributor

@carlpartridge carlpartridge commented Oct 16, 2024

🎫 Ticket

https://jira.cms.gov/browse/BCDA-8426

🛠 Changes

Enable swapping of queueing libraries based on env var.

ℹ️ Context

This is an initial stepping stone in the process of replacing our queueing library. This PR specifically sets up the ability to switch between queueing libraries with a restart. See https://confluence.cms.gov/display/BCDA/2024-09-26%3A+Replace+Queue+Library for more context.

🧪 Validation

Full test suite and linting pass.

@carlpartridge carlpartridge requested a review from a team October 16, 2024 21:29
@carlpartridge carlpartridge force-pushed the carl/BCDA-8426-enable-swappable-queuing-library branch from 7605b2d to 130b32d Compare October 16, 2024 21:32
@@ -632,6 +632,7 @@ func (h *Handler) bulkRequest(w http.ResponseWriter, r *http.Request, reqType se
sinceParam := (!rp.Since.IsZero() || conditions.ReqType == service.RetrieveNewBeneHistData)
jobPriority := h.Svc.GetJobPriority(conditions.CMSID, j.ResourceType, sinceParam) // first argument is the CMS ID, not the ACO uuid

logger.Infof("Adding jobs using %T", h.Enq)
Copy link
Contributor Author

@carlpartridge carlpartridge Oct 17, 2024

Choose a reason for hiding this comment

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

Sanity check logging that we are are using the proper queueing library. I dont totally understand why we seem to have different loggers and different access to them?

return riverEnqueuer{}
} else {
panic("NO QUEUE LIBRARY SET")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if panic-ing is better than just defaulting to a specific library?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we're going to a green-blue solution for the libraries I'd just default to que-go.

@@ -67,3 +74,13 @@ func (q queEnqueuer) AddAlrJob(job models.JobAlrEnqueueArgs, priority int) error

return q.Enqueue(j)
}

type riverEnqueuer struct{}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dummy type and interface for now.

@@ -10,6 +10,7 @@ BCDA_WORKER_ERROR_LOG=/var/log/worker/error.log
DEBUG=true
DEPLOYMENT_TARGET=dev
EXPIRED_THRESHOLD_HR=24
QUEUE_LIBRARY=que-go
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These files are the non-sensitive env vars used for each environment?

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.

2 participants