Remove event_queue GK
Summary: Did run for 2 months stable now, time to remove some dead code. Reviewed By: passy Differential Revision: D20556785 fbshipit-source-id: 514673995212d62d21744f304286caa6e91007fb
This commit is contained in:
committed by
Facebook GitHub Bot
parent
06cd90562d
commit
d103692883
@@ -25,11 +25,7 @@ import {EventEmitter} from 'events';
|
||||
import invariant from 'invariant';
|
||||
import {flipperRecorderAddEvent} from './utils/pluginStateRecorder';
|
||||
import {getPluginKey} from './utils/pluginUtils';
|
||||
import {
|
||||
processMessageImmediately,
|
||||
processMessageLater,
|
||||
} from './utils/messageQueue';
|
||||
import GK from './fb-stubs/GK';
|
||||
import {processMessageLater} from './utils/messageQueue';
|
||||
|
||||
type Plugins = Array<string>;
|
||||
|
||||
@@ -350,21 +346,12 @@ export default class Client extends EventEmitter {
|
||||
if (persistingPlugin && persistingPlugin.persistedStateReducer) {
|
||||
const pluginKey = getPluginKey(this.id, device, params.api);
|
||||
flipperRecorderAddEvent(pluginKey, params.method, params.params);
|
||||
if (GK.get('flipper_event_queue')) {
|
||||
processMessageLater(
|
||||
this.store,
|
||||
pluginKey,
|
||||
persistingPlugin,
|
||||
params,
|
||||
);
|
||||
} else {
|
||||
processMessageImmediately(
|
||||
this.store,
|
||||
pluginKey,
|
||||
persistingPlugin,
|
||||
params,
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.warn(
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import {FlipperPlugin} from '../../plugin';
|
||||
import {createMockFlipperWithPlugin} from '../../test-utils/createMockFlipperWithPlugin';
|
||||
import {GK, Store, Client} from '../../';
|
||||
import {Store, Client} from '../../';
|
||||
import {
|
||||
selectPlugin,
|
||||
starPlugin,
|
||||
@@ -84,28 +84,10 @@ function selectTestPlugin(store: Store, client: Client) {
|
||||
);
|
||||
}
|
||||
|
||||
test('will process event with GK disabled', async () => {
|
||||
await createMockFlipperWithPlugin(
|
||||
TestPlugin,
|
||||
async ({store, sendMessage}) => {
|
||||
expect(store.getState().connections.selectedPlugin).toBe('TestPlugin');
|
||||
sendMessage('inc', {});
|
||||
expect(store.getState().pluginStates).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"TestApp#Android#MockAndroidDevice#serial#TestPlugin": Object {
|
||||
"count": 1,
|
||||
},
|
||||
}
|
||||
`);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test('queue - events are processed immediately if plugin is selected', async () => {
|
||||
await createMockFlipperWithPlugin(
|
||||
TestPlugin,
|
||||
async ({store, sendMessage}) => {
|
||||
await GK.withWhitelistedGK('flipper_event_queue', () => {
|
||||
expect(store.getState().connections.selectedPlugin).toBe('TestPlugin');
|
||||
sendMessage('inc', {});
|
||||
expect(store.getState().pluginStates).toMatchInlineSnapshot(`
|
||||
@@ -118,7 +100,6 @@ test('queue - events are processed immediately if plugin is selected', async ()
|
||||
expect(store.getState().pluginMessageQueue).toMatchInlineSnapshot(
|
||||
`Object {}`,
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -127,7 +108,6 @@ test('queue - events are NOT processed immediately if plugin is NOT selected (bu
|
||||
await createMockFlipperWithPlugin(
|
||||
TestPlugin,
|
||||
async ({client, device, store, sendMessage}) => {
|
||||
await GK.withWhitelistedGK('flipper_event_queue', async () => {
|
||||
selectDeviceLogs(store);
|
||||
expect(store.getState().connections.selectedPlugin).not.toBe(
|
||||
'TestPlugin',
|
||||
@@ -135,9 +115,7 @@ test('queue - events are NOT processed immediately if plugin is NOT selected (bu
|
||||
|
||||
sendMessage('inc', {});
|
||||
sendMessage('inc', {delta: 2});
|
||||
expect(store.getState().pluginStates).toMatchInlineSnapshot(
|
||||
`Object {}`,
|
||||
);
|
||||
expect(store.getState().pluginStates).toMatchInlineSnapshot(`Object {}`);
|
||||
expect(store.getState().pluginMessageQueue).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"TestApp#Android#MockAndroidDevice#serial#TestPlugin": Array [
|
||||
@@ -193,7 +171,6 @@ test('queue - events are NOT processed immediately if plugin is NOT selected (bu
|
||||
expect(store.getState().pluginMessageQueue).toEqual({
|
||||
[pluginKey]: [{method: 'inc', params: {delta: 5}}],
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -202,7 +179,6 @@ test('queue - events are queued for plugins that are favorite when app is not se
|
||||
await createMockFlipperWithPlugin(
|
||||
TestPlugin,
|
||||
async ({device, store, sendMessage, createClient}) => {
|
||||
await GK.withWhitelistedGK('flipper_event_queue', async () => {
|
||||
selectDeviceLogs(store);
|
||||
expect(store.getState().connections.selectedPlugin).not.toBe(
|
||||
'TestPlugin',
|
||||
@@ -214,9 +190,7 @@ test('queue - events are queued for plugins that are favorite when app is not se
|
||||
// Now we send a message to the second client, it should arrive,
|
||||
// as the plugin was enabled already on the first client as well
|
||||
sendMessage('inc', {delta: 2});
|
||||
expect(store.getState().pluginStates).toMatchInlineSnapshot(
|
||||
`Object {}`,
|
||||
);
|
||||
expect(store.getState().pluginStates).toMatchInlineSnapshot(`Object {}`);
|
||||
expect(store.getState().pluginMessageQueue).toMatchInlineSnapshot(
|
||||
`
|
||||
Object {
|
||||
@@ -231,7 +205,6 @@ test('queue - events are queued for plugins that are favorite when app is not se
|
||||
}
|
||||
`,
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -240,7 +213,6 @@ test('queue - events are queued for plugins that are favorite when app is select
|
||||
await createMockFlipperWithPlugin(
|
||||
TestPlugin,
|
||||
async ({client, store, sendMessage, createDevice, createClient}) => {
|
||||
await GK.withWhitelistedGK('flipper_event_queue', async () => {
|
||||
selectDeviceLogs(store);
|
||||
expect(store.getState().connections.selectedPlugin).not.toBe(
|
||||
'TestPlugin',
|
||||
@@ -254,9 +226,7 @@ test('queue - events are queued for plugins that are favorite when app is select
|
||||
// Now we send a message to the second client, it should arrive,
|
||||
// as the plugin was enabled already on the first client as well
|
||||
sendMessage('inc', {delta: 2});
|
||||
expect(store.getState().pluginStates).toMatchInlineSnapshot(
|
||||
`Object {}`,
|
||||
);
|
||||
expect(store.getState().pluginStates).toMatchInlineSnapshot(`Object {}`);
|
||||
expect(store.getState().pluginMessageQueue).toMatchInlineSnapshot(
|
||||
`
|
||||
Object {
|
||||
@@ -271,7 +241,6 @@ test('queue - events are queued for plugins that are favorite when app is select
|
||||
}
|
||||
`,
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -280,7 +249,6 @@ test('queue - events processing will be paused', async () => {
|
||||
await createMockFlipperWithPlugin(
|
||||
TestPlugin,
|
||||
async ({client, device, store, sendMessage}) => {
|
||||
await GK.withWhitelistedGK('flipper_event_queue', async () => {
|
||||
selectDeviceLogs(store);
|
||||
|
||||
sendMessage('inc', {});
|
||||
@@ -325,7 +293,6 @@ test('queue - events processing will be paused', async () => {
|
||||
// don't idle anymore
|
||||
idler.run();
|
||||
await p;
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -334,7 +301,6 @@ test('queue - messages that arrive during processing will be queued', async () =
|
||||
await createMockFlipperWithPlugin(
|
||||
TestPlugin,
|
||||
async ({client, device, store, sendMessage}) => {
|
||||
await GK.withWhitelistedGK('flipper_event_queue', async () => {
|
||||
selectDeviceLogs(store);
|
||||
|
||||
sendMessage('inc', {});
|
||||
@@ -380,7 +346,6 @@ test('queue - messages that arrive during processing will be queued', async () =
|
||||
|
||||
idler.run();
|
||||
await p;
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -389,7 +354,6 @@ test('queue - processing can be cancelled', async () => {
|
||||
await createMockFlipperWithPlugin(
|
||||
TestPlugin,
|
||||
async ({client, device, store, sendMessage}) => {
|
||||
await GK.withWhitelistedGK('flipper_event_queue', async () => {
|
||||
selectDeviceLogs(store);
|
||||
|
||||
sendMessage('inc', {});
|
||||
@@ -421,7 +385,6 @@ test('queue - processing can be cancelled', async () => {
|
||||
expect(store.getState().pluginMessageQueue[pluginKey].length).toBe(1);
|
||||
expect(store.getState().pluginStates[pluginKey].count).toBe(10);
|
||||
await p;
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -430,7 +393,6 @@ test('queue - make sure resetting plugin state clears the message queue', async
|
||||
await createMockFlipperWithPlugin(
|
||||
TestPlugin,
|
||||
async ({client, device, store, sendMessage}) => {
|
||||
await GK.withWhitelistedGK('flipper_event_queue', async () => {
|
||||
selectDeviceLogs(store);
|
||||
|
||||
sendMessage('inc', {});
|
||||
@@ -446,7 +408,6 @@ test('queue - make sure resetting plugin state clears the message queue', async
|
||||
});
|
||||
|
||||
expect(store.getState().pluginMessageQueue[pluginKey]).toBe(undefined);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user