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

Kanta duplicates kanta_message records when context is null #65

Open
kubosuke opened this issue Jun 28, 2024 · 2 comments
Open

Kanta duplicates kanta_message records when context is null #65

kubosuke opened this issue Jun 28, 2024 · 2 comments
Assignees

Comments

@kubosuke
Copy link
Contributor

kubosuke commented Jun 28, 2024

Environment

  • fly.io
  • Elixir 1.17
  • Postgres 14
  • po files:
❯ find . -name "default.po"
./priv/gettext/nl/LC_MESSAGES/default.po
./priv/gettext/en/LC_MESSAGES/default.po

Overview

in our application, Kanta duplicates Message records and it causes unexpected behaviour.

image

as we investigate the behaviour, we found that unique constraint is defined at here:

create_if_not_exists unique_index(@kanta_messages, [:context_id, :domain_id, :msgid])

but it didn't work properly, because we don't define any context, and contexts are registered as null in the database.
ref: https://stackoverflow.com/a/8289253

How about forcing users to define context, or set default context if it's not defined?

@kubosuke kubosuke changed the title Kanta duplicates messages when deploying multiple application nodes Kanta duplicates kanta_message records when context is null Jun 30, 2024
@ravensiris
Copy link
Contributor

@kubosuke
Hi, got assigned to this issue.
Seems like you've made a PR but closed it.
Was there a reason for closing?
Did it not solve your issue?

@kubosuke
Copy link
Contributor Author

@ravensiris
Hi thanks for your reply.

Yeah once I thought by applying default context we could resolve this issue like this:
https://github.com/curiosum-dev/kanta/pull/66/files

but finally we decided to apply additional UNIQUE constraint to :domain_id, :msgid cause it's easier and it doesn't require to modify current kanta codes. but it'd be nice if we can apply default context if it's missing.

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

No branches or pull requests

2 participants