6.12.127 • Published 10 months ago

@diotoborg/repellat-blanditiis-quis v6.12.127

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Async Await Mutex Lock

Tests

Mutex locks for async functions with functionality to use keys for separate locks

NPM

Usage Instructions

Without Key

import { Lock } from "@diotoborg/repellat-blanditiis-quis";

let lock = new Lock();

async function serialTask() {
  await lock.acquire();

  try {
    // Don't return a promise here as Promise may resolve after finally
    // has executed
  } finally {
    lock.release();
  }
}

With Key

All the keys will have their own separate locks and separate waiting lists. A key can have any type (eg. string, number, etc. or a custom type allowed by typescript as a Map key)

import { Lock } from "@diotoborg/repellat-blanditiis-quis";

let lock = new Lock<string>();

async function serialTask() {
  await lock.acquire("myKey");

  try {
    // Don't return a promise here as Promise may resolve after finally
    // has executed
  }
  finally {
    lock.release("myKey");
  }
}

async function serialTaskTwo() {
  await lock.acquire("myKeyTwo");

  try {
    // Don't return a promise here as Promise may resolve after finally
    // has executed
  }
  finally {
    lock.release("myKeyTwo");
  }
}

Checking if a lock is acquired or not

import { Lock } from "@diotoborg/repellat-blanditiis-quis";

let lock = new Lock();

async function serialTask() {
  await lock.acquire();

  console.log(lock.isAcquired()); // prints true
}

isAcquired() with key checks for the given key separately.

import { Lock } from "@diotoborg/repellat-blanditiis-quis";

let lock = new Lock<string>();

async function serialTask() {
  await lock.acquire("myKey");

  console.log(lock.isAcquired("myKey")) // prints true
}

Issues or Bugs

In case of any issues or bugs, please open a pull request here

stringifyidlefunctionsgetintrinsicECMAScript 2018takeprivatemetadataa11yquerykeytouchcommandless cssbatchamazonkinesisvalidatedescriptorsratelimitfile systemagentes-abstractiterateestreereact-testing-libraryeslinttrimLeftes5apipolyfillJSON-SchemaauthenticationstableES2022someboundastebsformomitsyntaxbufferspinnersfpsmakeeventEmitterresolves3package.jsoncodestypeoftypesstreams2schemeAsyncIteratorstdlibhttpsECMAScript 5widthlisteners0setterparentrangeerrorfigleteventsECMAScript 2016csscomputed-typescloudwatchconcatmkdirexecUint16Arraybcryptpostcss-pluginprogresssettingsRxJSbyteOffsetcorebootstrap csswgetasyncwatchECMAScript 3assertpromisegenericsfunctionaldeepwordwrapvaluekoreanflatgetPrototypeOfECMAScript 2023Array.prototype.containsproxydeterministicObject.keysdom-testing-librarymime-dbdatastructuretaskwriteexpressregular expressionxtermcore-jsdayjsconcurrencyisConcatSpreadablesafeCSSStyleDeclarationreact-hook-formfolderfindvestconsumecallbindes-shimsinputwordbreakpretty$.extendES6real-timeStreamlibphonenumberstreamclientcolorworkflowlookautoscalingsetImmediatequeueruntimevisualmixinschromiumargsjoiawaitspeedendpointeast-asian-widthnegativees7getoptchinesewaitextrabindfluxconsoleregexreactjsxURLSearchParamsES2018Symbol.toStringTagnameses8dotenvdeepcloneredux-toolkitpredictableeventDispatcherES2023protobufrandomvalidationES2021typedarray__proto__duplexArray.prototype.findLastcolorsmkdirpbytestyleguidebrowserlistsameValueZerocreateequalstructuredClonenodewhatwgiterationurlslicegradients cssidESnextdependency managerpnpm9Uint32ArrayjsflagUint8ArraysearchinternalsetPrototypeOfoptimistrgbReactiveXperformantemitfullxhrtypedtelephonermmatchesHyBiutil.inspectECMAScript 2015styledeep-copyroute53configReflect.getPrototypeOfelbkeysgetESserializefastifyfssuperagentObject.valueswrapcommand-linestringparentsimportexportwarningbannerFloat64ArraytoolsnopemimejsondefinePropertysideelectronshamfixed-widthsyntaxerrorbundlingespreepropertiescheckcryptorateInt32ArrayconcatMaplrues2018linewrapcontainsStreamsprivate dataUnderscorehotUint8ClampedArraywatchercircularfast-copyinstallermiddlewarees6patharraybufferfindLastIndexlivecallArray.prototype.includesunicodetoStringTagformattingArraymatchAllECMAScript 6apolloio-ts256sharedtc39outputES2015timecss nestingObject.assigntypedarraysrequireredactloadbalancingsuperstructstylesvpcsnsconnectes-shim APIarraycolumnsES7toSortedminimalflattensimpledbWeakSetES2020.envfullwidthqsperformanceURLcomparechaifindLastArray.prototype.findLastIndexInt16ArraystringifierworkertoolkitawesomesaucewalkingarktypearthasOwnPropertyObject.isdataviewobjectfseventscompile lesstermcharacterfind-upawspropmapreducejsdiffinvariantes2017reusegraphqltapcloudformationstylesheetutilitiesinstallmatchargumentexpressionbyteLengthmobilewatchingES8npmtyped arrayreduxBigInt64Arrayclass-validatorutilmimetypesdirreadableObservableObject.definePropertyreducelintpackage managerenderinternal slotrapidECMAScript 2020jestown
@diotoborg/vero-atque@diotoborg/vero-eligendi-deleniti@diotoborg/vero-quaerat@diotoborg/vero-sit-doloribus@diotoborg/vitae-quo@diotoborg/voluptate-eius@diotoborg/voluptate-fuga@diotoborg/voluptate-sequi-natus@diotoborg/voluptatum-veritatis@diotoborg/voluptatum-voluptas-enim@diotoborg/a-odio@diotoborg/ad-non@diotoborg/atque-dolorem-ratione@diotoborg/consectetur-consequuntur@diotoborg/consectetur-fuga@diotoborg/consectetur-modi-reprehenderit@diotoborg/consequatur-aut@diotoborg/consequatur-sunt@diotoborg/consequatur-velit-quae@diotoborg/consequuntur-dolorem-dicta@diotoborg/consequuntur-laboriosam@diotoborg/consequuntur-laborum@diotoborg/corporis-labore@diotoborg/enim-veritatis@diotoborg/esse-accusantium-ratione@diotoborg/esse-distinctio-repellat@diotoborg/est-beatae@diotoborg/et-maxime-hic@diotoborg/eum-porro@diotoborg/eum-tempora-distinctio@diotoborg/excepturi-incidunt@diotoborg/facilis-pariatur@diotoborg/et-voluptatum-mollitia@diotoborg/eveniet-officia@diotoborg/exercitationem-culpa@diotoborg/explicabo-optio@diotoborg/facilis-unde@diotoborg/fuga-molestias@diotoborg/fuga-nihil@diotoborg/esse-perspiciatis-voluptatem@diotoborg/et-facere-iusto@diotoborg/eum-est-nulla@diotoborg/excepturi-deserunt-eaque@diotoborg/et-architecto@diotoborg/eveniet-magnam@diotoborg/explicabo-nam-iste@diotoborg/fuga-rem-inventore@diotoborg/est-necessitatibus@diotoborg/eum-deleniti-tempora@diotoborg/eveniet-eaque-fugit@diotoborg/explicabo-laboriosam-maxime@diotoborg/explicabo-vitae-velit@diotoborg/eos-quidem@diotoborg/error-nesciunt-qui@diotoborg/est-voluptate@diotoborg/eveniet-pariatur-esse@diotoborg/explicabo-pariatur@diotoborg/eligendi-est-unde@diotoborg/ex-repellat@diotoborg/facilis-perferendis@diotoborg/corporis-voluptatum-saepe@diotoborg/delectus-necessitatibus-voluptatum@diotoborg/dignissimos-officiis@diotoborg/distinctio-quaerat@diotoborg/distinctio-quia@diotoborg/dolore-odio-est@diotoborg/dolorum-saepe@diotoborg/earum-eligendi@diotoborg/corporis-repellat-dicta@diotoborg/deleniti-totam-suscipit@diotoborg/dolor-earum-quia@diotoborg/dolor-iure@diotoborg/dolorem-dolorem@diotoborg/dolores-velit@diotoborg/doloribus-error@diotoborg/eaque-iusto@diotoborg/eius-pariatur@diotoborg/cum-aliquam@diotoborg/cupiditate-perferendis-repudiandae@diotoborg/deserunt-illo-tempora@diotoborg/ea-consectetur@diotoborg/ducimus-eveniet@diotoborg/dolorum-unde@diotoborg/corporis-quia@diotoborg/corporis-optio-tenetur@diotoborg/debitis-blanditiis-dolore@diotoborg/deserunt-eum@diotoborg/dolore-nesciunt@diotoborg/dolorum-tempora@diotoborg/eius-animi-ullam@diotoborg/earum-eum-doloribus@diotoborg/culpa-at-cumque@diotoborg/cumque-repellat@diotoborg/cumque-velit-eius@diotoborg/dignissimos-aliquam@diotoborg/distinctio-sed@diotoborg/dolorem-possimus@diotoborg/eaque-illum-qui@diotoborg/corrupti-beatae@diotoborg/culpa-amet-totam
6.12.126

10 months ago

6.12.127

10 months ago

5.10.117

10 months ago

5.10.116

10 months ago

4.9.113

10 months ago

4.9.110

11 months ago

4.9.111

11 months ago

4.9.112

11 months ago

5.12.124

10 months ago

5.12.123

10 months ago

5.12.122

10 months ago

4.10.113

10 months ago

5.12.121

10 months ago

5.10.115

10 months ago

5.10.114

10 months ago

5.10.113

10 months ago

1.2.16

1 year ago

1.2.17

1 year ago

1.2.14

1 year ago

4.7.110

11 months ago

1.2.15

1 year ago

5.12.126

10 months ago

5.12.125

10 months ago

4.6.100

11 months ago

2.3.49

1 year ago

2.3.48

1 year ago

4.5.83

12 months ago

4.5.84

12 months ago

4.5.81

12 months ago

4.5.82

12 months ago

4.5.85

12 months ago

4.5.86

12 months ago

2.3.57

1 year ago

2.3.56

1 year ago

2.3.53

1 year ago

2.3.52

1 year ago

2.3.55

1 year ago

2.3.54

1 year ago

2.3.51

1 year ago

2.3.50

1 year ago

4.6.88

11 months ago

4.6.89

11 months ago

4.6.86

11 months ago

4.6.87

11 months ago

4.4.69

12 months ago

4.4.68

12 months ago

4.4.67

1 year ago

4.4.66

1 year ago

5.11.121

10 months ago

4.6.109

11 months ago

5.11.120

10 months ago

4.6.107

11 months ago

4.6.108

11 months ago

4.6.105

11 months ago

4.6.106

11 months ago

4.6.103

11 months ago

4.6.104

11 months ago

4.6.101

11 months ago

4.6.102

11 months ago

4.6.110

11 months ago

4.8.110

11 months ago

5.11.119

10 months ago

5.11.118

10 months ago

5.11.117

10 months ago

1.2.18

1 year ago

1.2.19

1 year ago

3.4.61

1 year ago

3.4.62

1 year ago

3.4.63

1 year ago

3.4.64

1 year ago

3.4.65

1 year ago

3.4.66

1 year ago

4.4.81

12 months ago

4.4.80

12 months ago

2.2.39

1 year ago

2.2.37

1 year ago

2.2.38

1 year ago

2.4.58

1 year ago

2.2.35

1 year ago

2.4.57

1 year ago

2.2.36

1 year ago

1.2.20

1 year ago

2.2.33

1 year ago

2.4.59

1 year ago

2.2.34

1 year ago

1.2.23

1 year ago

1.2.24

1 year ago

1.2.21

1 year ago

1.2.22

1 year ago

1.2.27

1 year ago

1.2.28

1 year ago

1.2.25

1 year ago

1.2.26

1 year ago

1.2.29

1 year ago

4.6.91

11 months ago

4.6.92

11 months ago

4.6.90

11 months ago

4.6.95

11 months ago

4.4.72

12 months ago

4.6.96

11 months ago

4.4.71

12 months ago

4.6.93

11 months ago

4.4.70

12 months ago

4.6.94

11 months ago

4.6.99

11 months ago

4.4.76

12 months ago

4.4.75

12 months ago

4.6.97

11 months ago

4.4.74

12 months ago

2.2.48

1 year ago

4.6.98

11 months ago

4.4.73

12 months ago

2.2.46

1 year ago

1.2.30

1 year ago

4.4.79

12 months ago

2.2.47

1 year ago

1.2.31

1 year ago

4.4.78

12 months ago

2.2.44

1 year ago

4.4.77

12 months ago

2.2.45

1 year ago

2.2.42

1 year ago

2.2.43

1 year ago

2.2.40

1 year ago

1.2.32

1 year ago

2.2.41

1 year ago

1.2.33

1 year ago

2.4.61

1 year ago

2.4.60

1 year ago

1.2.13

1 year ago

1.2.12

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago