Skip to content

agent, ntf server: add lookupOrInsertIO, use it for locks and stats - #20

Draft
evgeny-simplex wants to merge 12 commits into
masterfrom
ep/lookup-or-insert-io
Draft

evgeny-simplex wants to merge 12 commits into
masterfrom
ep/lookup-or-insert-io

Conversation

@evgeny-simplex

Copy link
Copy Markdown
Owner

TMap

  • lookupOrInsertIO: looks the key up without a transaction; if absent, looks it up again and inserts in one transaction. Returns Right for a found value, Left for an inserted one.

Agent

  • Map locks (connection, invitation, chat entity and service locks via withLockMap/withLocksMap): an existing lock is found without a transaction and then taken; a new lock is inserted already taken. A thread waiting for a lock no longer re-runs its transaction on every insert into the lock map.
  • createLock is removed (unused).

Ntf server

  • incServerStat uses lookupOrInsertIO instead of its own double lookup.

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.

1 participant