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

Avram::Database.transaction block return behavior undocumented and may be incorrect #416

Closed
BrucePerens opened this issue Jul 1, 2020 · 2 comments · Fixed by #626
Closed
Assignees

Comments

@BrucePerens
Copy link

BrucePerens commented Jul 1, 2020

Avram::Database.transaction wants the transaction block to always return true. This is not documented, and is probably a left-over from when someone was designing how the user would roll back the transaction, perhaps returning false was considered for initiating a rollback. Obviously we have Avram::Database.rollback to do that today, so the transaction block should have its return value ignored.

@BrucePerens
Copy link
Author

BrucePerens commented Nov 14, 2020

The problem still exists. Avram::Database#transaction wants the transaction block to return true here.

# :nodoc:
  def transaction : Bool
    if current_transaction
      yield
    else
      wrap_in_transaction do
        yield
      end
    end
  end

@matthewmcgarvey
Copy link
Member

While I think we could work around it, this stems from the crystal-db library crystal-lang/crystal-db#145

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 a pull request may close this issue.

2 participants