Skip to content

Fix database connection error when using JsonGameSerializer#457

Merged
lare96 merged 1 commit intoluna-rs:masterfrom
hydrozoa-yt:sql-error-using-jsonserializer
Mar 1, 2026
Merged

Fix database connection error when using JsonGameSerializer#457
lare96 merged 1 commit intoluna-rs:masterfrom
hydrozoa-yt:sql-error-using-jsonserializer

Conversation

@hydrozoa-yt
Copy link
Contributor

Proposed changes

This small change fixes an error caused by trying to connect to the database in the World constructor, regardless of which serializer is configured. When using the json serializer, no database will be available, but the connection pool will be initialized anyway, causing the error. This patch checks if the json serializer is used, and initializes the connection pool to null if it is. This has no side effects, as the only class that uses this connection pool (besides the sql serializer) is BotRepository, and it correctly chooses between local storage and the database, depending on the serializer used.

Pull Request type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • Unit tests pass locally, after applying my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation
  • Any dependent changes have been merged and published in downstream modules

Further comments

None.

Copy link
Member

@lare96 lare96 left a comment

Choose a reason for hiding this comment

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

Great work, thank you!

@lare96 lare96 merged commit 97e2219 into luna-rs:master Mar 1, 2026
1 check failed
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