Skip to content

Commit

Permalink
deprecate xpack.xpack_main.xpack_api_polling_frequency_millis
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Dec 13, 2019
1 parent 33c4b7c commit ad130b4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
4 changes: 0 additions & 4 deletions x-pack/legacy/plugins/xpack_main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

import { resolve } from 'path';
import dedent from 'dedent';
import {
XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS
} from '../../server/lib/constants';
import { mirrorPluginStatus } from '../../server/lib/mirror_plugin_status';
import { replaceInjectedVars } from './server/lib/replace_injected_vars';
import { setupXPackMain } from './server/lib/setup_xpack_main';
Expand All @@ -34,7 +31,6 @@ export const xpackMain = (kibana) => {
enabled: Joi.boolean().default(),
url: Joi.string().default(),
}).default(), // deprecated
xpack_api_polling_frequency_millis: Joi.number().default(XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS),
}).default();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ describe('setupXPackMain()', () => {
ext() {}
});

// Make sure we don't misspell config key.
// Make sure plugins doesn't consume config
const configGetStub = sinon.stub().throws(new Error('`config.get` is called with unexpected key.'));
configGetStub.withArgs('xpack.xpack_main.xpack_api_polling_frequency_millis').returns(1234);
mockServer.config.returns({ get: configGetStub });
});

Expand Down
9 changes: 8 additions & 1 deletion x-pack/plugins/licensing/server/licensing_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@
*/

import { schema, TypeOf } from '@kbn/config-schema';
import { PluginConfigDescriptor } from 'kibana/server';

export const config = {
export const config: PluginConfigDescriptor = {
schema: schema.object({
pollingFrequency: schema.duration({ defaultValue: '30s' }),
}),
deprecations: ({ renameFromRoot }) => [
renameFromRoot(
'xpack.xpack_main.xpack_api_polling_frequency_millis',
'xpack.licensing.pollingFrequency'
),
],
};

export type LicenseConfigType = TypeOf<typeof config.schema>;
2 changes: 2 additions & 0 deletions x-pack/plugins/licensing/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ export class LicensingPlugin implements Plugin<LicensingPluginSetup> {
}

private createLicensePoller(clusterClient: IClusterClient, pollingFrequency: number) {
this.logger.debug(`Polling Elasticsearch License API with frequency ${pollingFrequency}ms.`);

const intervalRefresh$ = timer(0, pollingFrequency);

const { license$, refreshManually } = createLicenseUpdate(intervalRefresh$, this.stop$, () =>
Expand Down
1 change: 0 additions & 1 deletion x-pack/test/licensing_plugin/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {
serverArgs: [
...functionalTestsConfig.get('kbnTestServer.serverArgs'),
'--xpack.licensing.pollingFrequency=300',
'--xpack.xpack_main.xpack_api_polling_frequency_millis=300',
],
},

Expand Down

0 comments on commit ad130b4

Please sign in to comment.