Skip to content

Commit

Permalink
Replace setting job.index.name for a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
QU3B1M committed Jan 13, 2025
1 parent d4c14d4 commit b06a775
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
1 change: 0 additions & 1 deletion plugins/command-manager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ testClusters.integTest {
setting 'command_manager.job.schedule', '60'
setting 'command_manager.job.page_size', '100'
setting 'command_manager.job.pit_keep_alive', '10'
setting 'command_manager.job.index.name', 'job_index'
setting 'command_manager.job.index.template', 'job_template'
setting 'command_manager.api.prefix', '/api'
setting 'command_manager.api.endpoint', 'endpoint'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public List<Setting<?>> getSettings() {
PluginSettings.JOB_PAGE_SIZE,
PluginSettings.JOB_SCHEDULE,
PluginSettings.JOB_KEEP_ALIVE,
PluginSettings.JOB_INDEX_NAME,
PluginSettings.JOB_INDEX_TEMPLATE,
PluginSettings.API_PREFIX,
PluginSettings.API_ENDPOINT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public class PluginSettings {
private static final Integer DEFAULT_SCHEDULE = 1;
private static final Integer DEFAULT_PAGE_SIZE = 100;
private static final Integer DEFAULT_KEEP_ALIVE = 30;
/* DEFAULT_JOB_INDEX is retained and consumed as constant and not a Setting
* because the job's index name value is used in the getJobIndex() getter function of
* the CommandManagerPlugin class, it being required for the JobSchedulerExtension
* interface, which is loaded before the settings.
*/
private static final String DEFAULT_JOB_INDEX = ".scheduled-commands";
private static final String DEFAULT_JOB_INDEX_TEMPLATE = "index-template-scheduled-commands";
private static final String DEFAULT_PREFIX = "/_command_manager";
Expand Down Expand Up @@ -64,12 +69,6 @@ public class PluginSettings {
DEFAULT_KEEP_ALIVE,
Setting.Property.NodeScope,
Setting.Property.Filtered);
public static final Setting<String> JOB_INDEX_NAME =
Setting.simpleString(
"command_manager.job.index.name",
DEFAULT_JOB_INDEX,
Setting.Property.NodeScope,
Setting.Property.Filtered);
public static final Setting<String> JOB_INDEX_TEMPLATE =
Setting.simpleString(
"command_manager.job.index.template",
Expand Down Expand Up @@ -105,7 +104,6 @@ public class PluginSettings {
private final Integer jobSchedule;
private final Integer jobPageSize;
private final Integer jobKeepAlive;
private final String jobIndexName;
private final String jobIndexTemplate;
private final String apiPrefix;
private final String apiEndpoint;
Expand All @@ -122,7 +120,6 @@ private PluginSettings(@NonNull final Settings settings) {
this.jobSchedule = JOB_SCHEDULE.get(settings);
this.jobPageSize = JOB_PAGE_SIZE.get(settings);
this.jobKeepAlive = JOB_KEEP_ALIVE.get(settings);
this.jobIndexName = JOB_INDEX_NAME.get(settings);
this.jobIndexTemplate = JOB_INDEX_TEMPLATE.get(settings);
this.apiPrefix = API_PREFIX.get(settings);
this.apiEndpoint = API_ENDPOINT.get(settings);
Expand All @@ -136,7 +133,6 @@ private PluginSettings(@NonNull final Settings settings) {
log.info("[SETTINGS] Job Schedule: {}", this.jobSchedule);
log.info("[SETTINGS] Job Page Size: {}", this.jobPageSize);
log.info("[SETTINGS] Job Keep Alive: {}", this.jobKeepAlive);
log.info("[SETTINGS] Job Index Name: {}", this.jobIndexName);
log.info("[SETTINGS] Job Index Template: {}", this.jobIndexTemplate);
log.info("[SETTINGS] API Prefix: {}", this.apiPrefix);
log.info("[SETTINGS] API Endpoint: {}", this.apiEndpoint);
Expand Down Expand Up @@ -190,8 +186,8 @@ public Integer getJobKeepAlive() {
return jobKeepAlive;
}

public String getJobIndexName() {
return jobIndexName;
public static String getJobIndexName() {
return DEFAULT_JOB_INDEX;
}

public String getJobIndexTemplate() {
Expand Down Expand Up @@ -234,8 +230,6 @@ public String toString() {
+ jobPageSize
+ ", jobKeepAlive="
+ jobKeepAlive
+ ", jobIndexName='"
+ jobIndexName
+ '\''
+ ", jobIndexTemplate='"
+ jobIndexTemplate
Expand Down

0 comments on commit b06a775

Please sign in to comment.