Skip to content

Commit

Permalink
Sets default lock timeout to 30 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
DougReeder committed Jan 5, 2024
1 parent 407a9be commit 3878680
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
# Support LTS versions based on https://nodejs.org/en/about/releases/
node-version: ['12', '14', '16']
node-version: ['18', '20', '21']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down
2 changes: 1 addition & 1 deletion bin/dev-conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"basePath": "",
"allow_signup": true,
"storage_path": "./dev-storage",
"lock_timeout_ms": 200,
"lock_timeout_ms": 30000,
"lock_stale_after_ms": 60000,
"cache_views": true,
"http": {
Expand Down
2 changes: 1 addition & 1 deletion contrib/openwrt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ Then you can enable and start the service:
service armadietto start

After than open in a browser your https://domainname:4443/ and signup for a new account.
Then try to use it with some like e.g. https://litewrite.net/
Then try to use it with some like e.g. https://litewrite.net/
6 changes: 3 additions & 3 deletions lib/stores/file_tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const writeFile = promisify(fs.writeFile);
class FileTree {
constructor (options) {
this._dir = path.resolve(options.path);
this._timeout = options.lock_timeout_ms ?? 200;
this._timeout = options.lock_timeout_ms ?? 30000;
this._stale = options.lock_stale_after_ms ?? 60000;
}

Expand Down Expand Up @@ -171,14 +171,14 @@ class FileTree {
}

async get (username, pathname, versions, head = false) {
const startTime = parseInt(Date.now());
const startTime = Date.now();

for (;;) {
try {
return await this._lockfree_get(username, pathname, versions, head);
} catch (e) {
if (e.message === 'ETag mismatch') {
const nowTime = parseInt(Date.now());
const nowTime = Date.now();
if (nowTime - startTime > this._timeout) {
throw e;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"license": "MIT",
"version": "0.2.0",
"engines": {
"node": ">=14.0"
"node": ">=18.0"
},
"bin": {
"armadietto": "./bin/armadietto.js"
Expand Down

0 comments on commit 3878680

Please sign in to comment.