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

fix: remove pg_notify usage in favor of polling #2094

Merged
merged 2 commits into from
Jul 17, 2024
Merged

Conversation

wesbillman
Copy link
Collaborator

@wesbillman wesbillman commented Jul 17, 2024

Fixes #2087

@wesbillman wesbillman requested a review from alecthomas as a code owner July 17, 2024 04:17
@wesbillman wesbillman requested review from a team and matt2e and removed request for a team July 17, 2024 04:17
@ftl-robot ftl-robot mentioned this pull request Jul 17, 2024
previousDeployments := make(map[string]deploymentState)

for {
delay := time.Millisecond * 500
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do we want this to be configurable maybe?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I vote for getting it in as is and adding an option if there's a need

Comment on lines +63 to +67
hasher := sha256.New()
data := []byte(deployment.Schema.String())
if _, err := hasher.Write(data); err != nil {
return deploymentState{}, fmt.Errorf("failed to hash schema: %w", err)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the hashing I had to change to. It seemed like sha256.fromBytes just didn't compute a different has at all, but maybe I was using it wrong.

newState := moduleStateEntry{
hash: sha256.FromBytes(moduleSchemaBytes),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This seemed to compute the same hash every time even if the schema changed.

Copy link
Collaborator

@matt2e matt2e left a comment

Choose a reason for hiding this comment

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

LGTM!

@wesbillman wesbillman force-pushed the remove-pg-notify-usage branch from e528974 to 30add04 Compare July 17, 2024 05:04
@matt2e matt2e merged commit 802aa90 into main Jul 17, 2024
59 checks passed
@matt2e matt2e deleted the remove-pg-notify-usage branch July 17, 2024 05:39
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.

Switch schema notifications from db to use polling
3 participants