-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use 'try'/'catch' rather than 'ets:whereis/1' for Khepri projections
`ets:whereis/1` adds some overhead - it's two ETS calls rather than one when `ets:whereis/1` returns a table identifier. It's also not atomic: the table could disappear between `ets:whereis/1` calls and the call to read data from a projection. We replace all `ets:whereis/1` calls on projection tables with `try`/`catch` and return default values when we catch the `badarg` `error` which ETS emits when passed a non-existing table name. One special case though is `ets:info/2` which returns `undefined` when passed a non-existing table names. That block is refactored to use a `case` instead.
- Loading branch information
1 parent
d4ea90d
commit 9f255db
Showing
7 changed files
with
247 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.