Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var PROMISE_TIMEOUT = 5000
// 5 seconds
var PROMISE_TIMEOUT = 10000
// 10 seconds, see ZD#4058685
var PROMISE_DONT_TIMEOUT = ['instances.create']
var ZAF_EVENT = /^zaf\./
var version = require('version')
Expand All @@ -16,7 +16,7 @@ window.Promise = Promise
// #timeoutReject(rejectionFn, name, params)
//
// Reject a request if required, given the rejection function, name (get, set or invoke)
// and arguments to that request. Falls back to 5000 second timeout with few exceptions.
// and arguments to that request. Falls back to 10000 second timeout with few exceptions.
//
function timeoutReject (reject, name, client, paramsArray) {
switch (name) {
Expand Down
17 changes: 9 additions & 8 deletions spec/client_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ describe('Client', function () {
var Tracking = require('../lib/tracking')
var Tracker = Tracking.Tracker
var Promise = window.Promise || require('native-promise-only')
var PROMISE_TIMEOUT = 10000
var sandbox = sinon.sandbox.create()
var origin = 'https://foo.zendesk.com'
var appGuid = 'ABC123'
Expand Down Expand Up @@ -571,10 +572,10 @@ describe('Client', function () {
}).to.throw(Error)
})

it('rejects the promise after 5 seconds', function (done) {
it('rejects the promise after 10 seconds', function (done) {
var clock = sinon.useFakeTimers()
promise = subject.get('ticket.subject')
clock.tick(5000)
clock.tick(PROMISE_TIMEOUT)
clock.restore()
expect(promise).to.be.rejectedWith(Error, 'Invocation request timeout').and.notify(done)
})
Expand Down Expand Up @@ -659,10 +660,10 @@ describe('Client', function () {
})
})

it('rejects the promise after 5 seconds', function (done) {
it('rejects the promise after 10 seconds', function (done) {
var clock = sinon.useFakeTimers()
promise = subject.set('ticket.subject', 'test')
clock.tick(5000)
clock.tick(PROMISE_TIMEOUT)
clock.restore()
expect(promise).to.be.rejectedWith(Error, 'Invocation request timeout').and.notify(done)
})
Expand Down Expand Up @@ -718,18 +719,18 @@ describe('Client', function () {
}).to.throw(Error, 'Invoke supports string arguments or an object with array of strings.')
})

it('rejects the promise after 5 seconds', function (done) {
it('rejects the promise after 10 seconds', function (done) {
var clock = sinon.useFakeTimers()
promise = subject.invoke('ticket.subject', 'test')
clock.tick(5000)
clock.tick(PROMISE_TIMEOUT)
clock.restore()
expect(promise).to.be.rejectedWith(Error, 'Invocation request timeout').and.notify(done)
})

it('doesnt reject whitelisted promises after 5 seconds', function (done) {
it('doesnt reject whitelisted promises after 10 seconds', function (done) {
var clock = sinon.useFakeTimers()
promise = subject.invoke('instances.create')
clock.tick(10000)
clock.tick(15000)
clock.restore()
expect(promise).to.eventually.become({ errors: {}, 'instances.create': { url: 'http://a.b' } }).and.notify(done)
window.addEventListener.callArgWith(1, {
Expand Down