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 { ...@@ -159,9 +159,12 @@ export default {
}); });
}, },
initiateMergePolling() { initiateMergePolling() {
simplePoll((continuePolling, stopPolling) => { simplePoll(
(continuePolling, stopPolling) => {
this.handleMergePolling(continuePolling, stopPolling); this.handleMergePolling(continuePolling, stopPolling);
}); },
{ timeout: 0 },
);
}, },
handleMergePolling(continuePolling, stopPolling) { handleMergePolling(continuePolling, stopPolling) {
this.service this.service
...@@ -192,6 +195,7 @@ export default { ...@@ -192,6 +195,7 @@ export default {
}) })
.catch(() => { .catch(() => {
new Flash(__('Something went wrong while merging this merge request. Please try again.')); // eslint-disable-line new Flash(__('Something went wrong while merging this merge request. Please try again.')); // eslint-disable-line
stopPolling();
}); });
}, },
initiateRemoveSourceBranchPolling() { initiateRemoveSourceBranchPolling() {
......
---
title: Disable timeout on merge request merging poll
merge_request: 25988
author:
type: fixed
...@@ -376,11 +376,29 @@ describe('ReadyToMerge', () => { ...@@ -376,11 +376,29 @@ describe('ReadyToMerge', () => {
}); });
describe('initiateMergePolling', () => { describe('initiateMergePolling', () => {
beforeEach(() => {
jasmine.clock().install();
});
afterEach(() => {
jasmine.clock().uninstall();
});
it('should call simplePoll', () => { it('should call simplePoll', () => {
const simplePoll = spyOnDependency(ReadyToMerge, 'simplePoll'); const simplePoll = spyOnDependency(ReadyToMerge, 'simplePoll');
vm.initiateMergePolling(); 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