diff --git a/flow/shared/constants.go b/flow/shared/constants.go index 48a6f8ae2f..0a2c3a7de6 100644 --- a/flow/shared/constants.go +++ b/flow/shared/constants.go @@ -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) +}