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

refactor: Remove SQS references from Coordinator #365

Merged
merged 11 commits into from
Nov 7, 2023

Conversation

morgsmccauley
Copy link
Collaborator

@morgsmccauley morgsmccauley commented Nov 6, 2023

Doing some clean-up to make the development of #200 a bit easier. Now that we have moved completely to Redis, this PR removes all SQS code/references from Coordinator.

Additionally, I did some small refactoring to QueryApiContext, adding both s3_client and json_rpc_client, allowing a single instance of each to be passed around and used throughout the code. Previously, many s3_clients were being instantiated in various parts of the code. This removed the dependancy on Opts from Historical Backfill, so that has also been removed.

Finally, I fixed all Clippy errors :)

@morgsmccauley morgsmccauley linked an issue Nov 6, 2023 that may be closed by this pull request
@morgsmccauley morgsmccauley marked this pull request as ready for review November 6, 2023 20:55
@morgsmccauley morgsmccauley requested a review from a team as a code owner November 6, 2023 20:55
) -> Option<JoinHandle<i64>> {
let redis_connection_manager = redis_connection_manager.clone();
let s3_client = s3_client.clone();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we clone these instead of using the referenced client directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tokio::spawn requires, and takes, ownership of the variables referenced, this is signified by the move keyword. The compiler does not know how long the async task (tokio::spawn) will last, and therefore cannot determine whether the reference will live long enough.

Cloning allows us to take ownership of the variable, which then means we can move it to the async task.

Copy link
Collaborator

@darunrs darunrs left a comment

Choose a reason for hiding this comment

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

We should also update the docker image to remove the aws queue references there. Also, has the changes been deployed to the AWS account to remove those resources already?

Comment on lines +320 to +323
if error
.downcast_ref::<aws_sdk_s3::error::NoSuchKey>()
.is_some()
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this code changed to catch more errors?

Copy link
Collaborator Author

@morgsmccauley morgsmccauley Nov 7, 2023

Choose a reason for hiding this comment

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

Nah it's just a clippy suggestion - it behaves the same

@morgsmccauley
Copy link
Collaborator Author

We should also update the docker image to remove the aws queue references there. Also, has the changes been deployed to the AWS account to remove those resources already?

The docker image doesn't reference AWS directly, but I assume you are referring to the configuration of the the docker container in GCP? I'll eventually raise another PR to remove that, as well as the terraform config for both GCP and AWS. For now, they'll just be silently ignored.

@darunrs
Copy link
Collaborator

darunrs commented Nov 7, 2023

Sweet! Thanks for taking care of all the clippy suggestions too!

@morgsmccauley morgsmccauley merged commit 6b53ca2 into main Nov 7, 2023
@morgsmccauley morgsmccauley deleted the 201-clean-up-sqs-code-in-coordinator-1 branch November 7, 2023 18:13
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.

Clean up SQS code in Coordinator
3 participants