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

Hooks: proper nesting with savepoints, customisation, fix tests #206

Merged
merged 1 commit into from
Jun 10, 2019
Merged

Hooks: proper nesting with savepoints, customisation, fix tests #206

merged 1 commit into from
Jun 10, 2019

Conversation

vonagam
Copy link
Contributor

@vonagam vonagam commented Jun 10, 2019

Instead of simply incrementing a counter start hook creates a nested transaction with a savepoint. Counter way fails with complex scenarios like new third test for hooks.

Added getKnex option for start hook. Allows to specify where to get knex from, so the hook can be used not only with feathers-knex service. Useful for feathers-objection and tests.

Fixed previous test and added two additional. Previous test was actually not working, it was passing simply because "people2" table was not existent. And initial design of replacing "COMMIT;" with "COMMITA;" was a mistake because a connection was not released afterwards (it was working initially because it was the last test, but stopped to be in #181).

Remark on history: as i understand in an attempt to fix the problem caused by the broken test #181 included a removal of some lines in hooks.js (a, b, c, d), that caused regression in unhandled rejections, so #196 was needed. It had advantage over initial solution in handling rejections from an establishing phase, but ate rejections from an execution phase (this should have been visible if the broken test was working and not turned off in #181). Now both establishing and execution phases should be handled right.

@daffl daffl merged commit 3ff7e04 into feathersjs-ecosystem:master Jun 10, 2019
@daffl
Copy link
Member

daffl commented Jun 10, 2019

Awesome, thank you for getting this fixed! Released as v5.1.0

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