6.12.127 • Published 9 months ago

@diotoborg/repellat-blanditiis-quis v6.12.127

Weekly downloads
-
License
MIT
Repository
github
Last release
9 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

9 months ago

6.12.127

9 months ago

5.10.117

9 months ago

5.10.116

9 months ago

4.9.113

9 months ago

4.9.110

9 months ago

4.9.111

9 months ago

4.9.112

9 months ago

5.12.124

9 months ago

5.12.123

9 months ago

5.12.122

9 months ago

4.10.113

9 months ago

5.12.121

9 months ago

5.10.115

9 months ago

5.10.114

9 months ago

5.10.113

9 months ago

1.2.16

1 year ago

1.2.17

1 year ago

1.2.14

1 year ago

4.7.110

9 months ago

1.2.15

1 year ago

5.12.126

9 months ago

5.12.125

9 months ago

4.6.100

10 months ago

2.3.49

12 months ago

2.3.48

12 months ago

4.5.83

10 months ago

4.5.84

10 months ago

4.5.81

10 months ago

4.5.82

10 months ago

4.5.85

10 months ago

4.5.86

10 months ago

2.3.57

11 months ago

2.3.56

11 months ago

2.3.53

12 months ago

2.3.52

12 months ago

2.3.55

11 months ago

2.3.54

12 months ago

2.3.51

12 months ago

2.3.50

12 months ago

4.6.88

10 months ago

4.6.89

10 months ago

4.6.86

10 months ago

4.6.87

10 months ago

4.4.69

11 months ago

4.4.68

11 months ago

4.4.67

11 months ago

4.4.66

11 months ago

5.11.121

9 months ago

4.6.109

10 months ago

5.11.120

9 months ago

4.6.107

10 months ago

4.6.108

10 months ago

4.6.105

10 months ago

4.6.106

10 months ago

4.6.103

10 months ago

4.6.104

10 months ago

4.6.101

10 months ago

4.6.102

10 months ago

4.6.110

9 months ago

4.8.110

9 months ago

5.11.119

9 months ago

5.11.118

9 months ago

5.11.117

9 months ago

1.2.18

1 year ago

1.2.19

1 year ago

3.4.61

11 months ago

3.4.62

11 months ago

3.4.63

11 months ago

3.4.64

11 months ago

3.4.65

11 months ago

3.4.66

11 months ago

4.4.81

11 months ago

4.4.80

11 months ago

2.2.39

12 months ago

2.2.37

12 months ago

2.2.38

12 months ago

2.4.58

11 months ago

2.2.35

1 year ago

2.4.57

11 months ago

2.2.36

12 months ago

1.2.20

1 year ago

2.2.33

1 year ago

2.4.59

11 months 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

10 months ago

4.6.92

10 months ago

4.6.90

10 months ago

4.6.95

10 months ago

4.4.72

11 months ago

4.6.96

10 months ago

4.4.71

11 months ago

4.6.93

10 months ago

4.4.70

11 months ago

4.6.94

10 months ago

4.6.99

10 months ago

4.4.76

11 months ago

4.4.75

11 months ago

4.6.97

10 months ago

4.4.74

11 months ago

2.2.48

12 months ago

4.6.98

10 months ago

4.4.73

11 months ago

2.2.46

12 months ago

1.2.30

1 year ago

4.4.79

11 months ago

2.2.47

12 months ago

1.2.31

1 year ago

4.4.78

11 months ago

2.2.44

12 months ago

4.4.77

11 months ago

2.2.45

12 months ago

2.2.42

12 months ago

2.2.43

12 months ago

2.2.40

12 months ago

1.2.32

1 year ago

2.2.41

12 months ago

1.2.33

1 year ago

2.4.61

11 months ago

2.4.60

11 months 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