Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh Rath committed Mar 10, 2023
1 parent 5f158ec commit d18e76e
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.git
.git
node_modules
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/dist
/node_modules
/dist
/node_modules
36 changes: 18 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
.DS_Store
*.sublime-workspace
/dist/**/*.js
/dist/**/*.js.map
/dist/**/*.d.ts
/node_modules
/npm-debug.log
/package-lock.json
/yarn-error.log
/yarn.lock

# Redis database
*.rdb

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
.DS_Store
*.sublime-workspace
/dist/**/*.js
/dist/**/*.js.map
/dist/**/*.d.ts
/node_modules
/npm-debug.log
/package-lock.json
/yarn-error.log
/yarn.lock

# Redis database
*.rdb

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
26 changes: 13 additions & 13 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"node": true,
"unused": "vars",
"multistr": true,
"globals": {
"describe": false,
"it": false,
"before": false,
"beforeEach": false,
"after": false,
"afterEach": false
}
}
{
"node": true,
"unused": "vars",
"multistr": true,
"globals": {
"describe": false,
"it": false,
"before": false,
"beforeEach": false,
"after": false,
"afterEach": false
}
}
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package-lock=false
package-lock=false
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/dist
/node_modules
/dist
/node_modules
44 changes: 22 additions & 22 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Mike Marcacci

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

The MIT License (MIT)
Copyright (c) 2015 Mike Marcacci
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 4 additions & 4 deletions cluster.redis.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
port 6379
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
port 6379
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
6 changes: 3 additions & 3 deletions dist/cjs/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"type": "commonjs"
}
{
"type": "commonjs"
}
6 changes: 3 additions & 3 deletions dist/esm/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"type": "module"
}
{
"type": "module"
}
20 changes: 10 additions & 10 deletions main.sublime-project
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"folders":
[
{
"path": ".",
"folder_exclude_patterns": ["**/node_modules", "**/dist"],
"name": "redlock"
}
]
}
{
"folders":
[
{
"path": ".",
"folder_exclude_patterns": ["**/node_modules", "**/dist"],
"name": "redlock"
}
]
}
18 changes: 9 additions & 9 deletions scripts/await.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

while [ ! -d "$1" ] && [ ! -f "$1" ]; do

echo "Waiting for '$1' to exist..."
sleep 1

done

#!/bin/bash

while [ ! -d "$1" ] && [ ! -f "$1" ]; do

echo "Waiting for '$1' to exist..."
sleep 1

done

eval "${*:2}"
15 changes: 9 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,11 @@ export default class Redlock extends EventEmitter {
const attempts: Promise<ExecutionStats>[] = [];

while (true) {
const { vote, stats, start } = await this._attemptOperation(script, keys, args);
const { vote, stats, start } = await this._attemptOperation(
script,
keys,
args
);

attempts.push(stats);

Expand Down Expand Up @@ -472,10 +476,9 @@ export default class Redlock extends EventEmitter {
keys: string[],
args: (string | number)[]
): Promise<
| { vote: "for"; stats: Promise<ExecutionStats>; start: number;}
| { vote: "against"; stats: Promise<ExecutionStats>; start: number; }
| { vote: "for"; stats: Promise<ExecutionStats>; start: number }
| { vote: "against"; stats: Promise<ExecutionStats>; start: number }
> {

const start = Date.now();

return await new Promise((resolve) => {
Expand Down Expand Up @@ -514,7 +517,7 @@ export default class Redlock extends EventEmitter {
resolve({
vote: "for",
stats: statsPromise,
start
start,
});
}

Expand All @@ -523,7 +526,7 @@ export default class Redlock extends EventEmitter {
resolve({
vote: "against",
stats: statsPromise,
start
start,
});
}

Expand Down

0 comments on commit d18e76e

Please sign in to comment.