Commit d50fe9e4 authored by Paul Slaughter's avatar Paul Slaughter

Update merge status timeout to 0

- Also stop polling if we get a bad response from the server.
parent 8c4d6ea2
......@@ -159,9 +159,12 @@ export default {
});
},
initiateMergePolling() {
simplePoll((continuePolling, stopPolling) => {
this.handleMergePolling(continuePolling, stopPolling);
});
simplePoll(
(continuePolling, stopPolling) => {
this.handleMergePolling(continuePolling, stopPolling);
},
{ timeout: 0 },
);
},
handleMergePolling(continuePolling, stopPolling) {
this.service
......@@ -192,6 +195,7 @@ export default {
})
.catch(() => {
new Flash(__('Something went wrong while merging this merge request. Please try again.')); // eslint-disable-line
stopPolling();
});
},
initiateRemoveSourceBranchPolling() {
......
---
title: Disable timeout on merge request merging poll
merge_request: 25988
author:
type: fixed
......@@ -376,11 +376,29 @@ describe('ReadyToMerge', () => {
});
describe('initiateMergePolling', () => {
beforeEach(() => {
jasmine.clock().install();
});
afterEach(() => {
jasmine.clock().uninstall();
});
it('should call simplePoll', () => {
const simplePoll = spyOnDependency(ReadyToMerge, 'simplePoll');
vm.initiateMergePolling();
expect(simplePoll).toHaveBeenCalled();
expect(simplePoll).toHaveBeenCalledWith(jasmine.any(Function), { timeout: 0 });
});
it('should call handleMergePolling', () => {
spyOn(vm, 'handleMergePolling');
vm.initiateMergePolling();
jasmine.clock().tick(2000);
expect(vm.handleMergePolling).toHaveBeenCalled();
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment