Skip to content

Commit

Permalink
prepend deployment_uid only if its set
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Nov 28, 2023
1 parent 2752413 commit ba9c23d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions flow/shared/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ const (
const FetchAndChannelSize = 256 * 1024

func GetPeerFlowTaskQueueName(taskQueueID TaskQueueID) (string, error) {
deploymentUID := os.Getenv("PEERDB_DEPLOYMENT_UID")
switch taskQueueID {
case PeerFlowTaskQueueID:
return deploymentUID + "-" + peerFlowTaskQueue, nil
return prependUIDToTaskQueueName(peerFlowTaskQueue), nil
case SnapshotFlowTaskQueueID:
return deploymentUID + "-" + snapshotFlowTaskQueue, nil
return prependUIDToTaskQueueName(snapshotFlowTaskQueue), nil
default:
return "", fmt.Errorf("unknown task queue id %d", taskQueueID)
}
}

func prependUIDToTaskQueueName(taskQueueName string) string {
deploymentUID := os.Getenv("PEERDB_DEPLOYMENT_UID")
if deploymentUID == "" {
return taskQueueName
}
return fmt.Sprintf("%s-%s", deploymentUID, taskQueueName)
}

0 comments on commit ba9c23d

Please sign in to comment.