Skip to content

Commit

Permalink
feat(qos): namespace redis buffered execution index (spinnaker#2347)
Browse files Browse the repository at this point in the history
  • Loading branch information
asher authored Aug 2, 2018
1 parent 47a29ed commit 9b220fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ public ExecutionRepository redisExecutionRepository(Registry registry,
RedisClientSelector redisClientSelector,
@Qualifier("queryAllScheduler") Scheduler queryAllScheduler,
@Qualifier("queryByAppScheduler") Scheduler queryByAppScheduler,
@Value("${chunkSize.executionRepository:75}") Integer threadPoolChunkSize) {
@Value("${chunkSize.executionRepository:75}") Integer threadPoolChunkSize,
@Value("${keiko.queue.redis.queueName:}") String bufferedPrefix) {
return new RedisInstrumentedExecutionRepository(
new RedisExecutionRepository(
registry,
redisClientSelector,
queryAllScheduler,
queryByAppScheduler,
threadPoolChunkSize
threadPoolChunkSize,
bufferedPrefix
),
registry
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,26 @@ public class RedisExecutionRepository implements ExecutionRepository, PollingAge
private final int chunkSize;
private final Scheduler queryAllScheduler;
private final Scheduler queryByAppScheduler;
private final Logger log = LoggerFactory.getLogger(getClass());

private final Registry registry;
private static String bufferedPrefix;

private final Logger log = LoggerFactory.getLogger(getClass());

public RedisExecutionRepository(
Registry registry,
RedisClientSelector redisClientSelector,
Scheduler queryAllScheduler,
Scheduler queryByAppScheduler,
Integer threadPoolChunkSize
Integer threadPoolChunkSize,
String bufferedPrefix
) {
this.registry = registry;
this.redisClientDelegate = redisClientSelector.primary(EXECUTION_REPOSITORY);
this.previousRedisClientDelegate = redisClientSelector.previous(EXECUTION_REPOSITORY);
this.queryAllScheduler = queryAllScheduler;
this.queryByAppScheduler = queryByAppScheduler;
this.chunkSize = threadPoolChunkSize;
this.bufferedPrefix = bufferedPrefix;
}

public RedisExecutionRepository(
Expand Down Expand Up @@ -1018,7 +1021,11 @@ protected static String executionsByPipelineKey(String pipelineConfigId) {
}

protected static String allBufferedExecutionsKey(ExecutionType type) {
return format("buffered:%s", type);
if (bufferedPrefix == null || bufferedPrefix.isEmpty()) {
return format("buffered:%s", type);
} else {
return format("%s:buffered:%s", bufferedPrefix, type);
}
}

protected static String executionKeyPattern(@Nullable ExecutionType type) {
Expand Down

0 comments on commit 9b220fb

Please sign in to comment.