Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 7ac6b30

Browse files
committed
fix: disable timeout if not set
Some of our operations take a really long time, if we don't set a timeout for `ky` we get the default of 10 seconds. This PR sets the timeout to `false` if one is not explicitly passed which disables it. Nb. I had to add the default to `false` to every invocation. Looking at the code it should be enough to do it in `src/lib/configure.js` but it doesn't seem to be.
1 parent c82b031 commit 7ac6b30

File tree

14 files changed

+14
-14
lines changed

14 files changed

+14
-14
lines changed

src/add/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = configure(({ ky }) => {
3131
if (options.preload !== null) searchParams.set('preload', options.preload)
3232

3333
const res = await ky.post('add', {
34-
timeout: options.timeout,
34+
timeout: options.timeout || false,
3535
signal: options.signal,
3636
headers: options.headers,
3737
searchParams,

src/block/rm-async-iterator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = configure(({ ky }) => {
2424
})
2525

2626
const res = await ky.post('block/rm', {
27-
timeout: options.timeout,
27+
timeout: options.timeout || false,
2828
signal: options.signal,
2929
headers: options.headers,
3030
searchParams

src/cat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = configure(({ ky }) => {
2121
if (options.length) searchParams.set('length', options.length)
2222

2323
const res = await ky.get('cat', {
24-
timeout: options.timeout,
24+
timeout: options.timeout || false,
2525
signal: options.signal,
2626
headers: options.headers,
2727
searchParams

src/config/profiles/apply.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = configure(({ ky }) => {
88
options = options || {}
99

1010
const res = await ky.post('config/profile/apply', {
11-
timeout: options.timeout,
11+
timeout: options.timeout || false,
1212
signal: options.signal,
1313
headers: options.headers,
1414
searchParams: {

src/config/profiles/list.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = configure(({ ky }) => {
99
options = options || {}
1010

1111
const res = await ky.get('config/profile/list', {
12-
timeout: options.timeout,
12+
timeout: options.timeout || false,
1313
signal: options.signal,
1414
headers: options.headers
1515
})

src/files-regular/get.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = configure(({ ky }) => {
3737
}
3838

3939
const res = await ky.get('get', {
40-
timeout: options.timeout,
40+
timeout: options.timeout || false,
4141
signal: options.signal,
4242
headers: options.headers,
4343
searchParams

src/files-regular/ls.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = configure(({ ky }) => {
3232
}
3333

3434
const res = await ky.get('ls', {
35-
timeout: options.timeout,
35+
timeout: options.timeout || false,
3636
signal: options.signal,
3737
headers: options.headers,
3838
searchParams

src/files-regular/refs-local.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = configure(({ ky }) => {
1010
options = options || {}
1111

1212
const res = await ky.get('refs/local', {
13-
timeout: options.timeout,
13+
timeout: options.timeout || false,
1414
signal: options.signal,
1515
headers: options.headers
1616
})

src/files-regular/refs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports = configure(({ ky }) => {
5050
}
5151

5252
const res = await ky.get('refs', {
53-
timeout: options.timeout,
53+
timeout: options.timeout || false,
5454
signal: options.signal,
5555
headers: options.headers,
5656
searchParams

src/lib/configure.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = create => config => {
2727
// https://github.com/sindresorhus/ky/pull/153
2828
ky: ky.extend({
2929
prefixUrl: config.apiAddr + config.apiPath,
30-
timeout: config.timeout || 60 * 1000,
30+
timeout: config.timeout || false,
3131
headers: config.headers,
3232
hooks: {
3333
afterResponse: [errorHandler]

src/pubsub/ls.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = configure(({ ky }) => {
77
options = options || {}
88

99
const { Strings } = await ky.get('pubsub/ls', {
10-
timeout: options.timeout,
10+
timeout: options.timeout || false,
1111
signal: options.signal,
1212
headers: options.headers,
1313
searchParams: options.searchParams

src/pubsub/peers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = configure(({ ky }) => {
1515
searchParams.set('arg', topic)
1616

1717
const { Strings } = await ky.get('pubsub/peers', {
18-
timeout: options.timeout,
18+
timeout: options.timeout || false,
1919
signal: options.signal,
2020
headers: options.headers,
2121
searchParams

src/pubsub/publish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = configure(({ ky }) => {
1212
searchParams.set('arg', topic)
1313

1414
const res = await ky.post(`pubsub/pub?${searchParams}&arg=${encodeBuffer(data)}`, {
15-
timeout: options.timeout,
15+
timeout: options.timeout || false,
1616
signal: options.signal,
1717
headers: options.headers
1818
}).text()

src/pubsub/subscribe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module.exports = configure((config) => {
3838

3939
try {
4040
res = await ky.post('pubsub/sub', {
41-
timeout: options.timeout,
41+
timeout: options.timeout || false,
4242
signal: options.signal,
4343
headers: options.headers,
4444
searchParams

0 commit comments

Comments
 (0)