Skip to content

Commit

Permalink
only creating stream if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
purehyperbole committed Jun 5, 2018
1 parent d57fb08 commit 5db7ded
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ func processBuild(msg *nats.Msg) {

switch msg.Subject {
case "build.create", "build.delete", "build.import", "environment.sync":
log.Println("Creating stream: ", id)
bc.CreateStream(id)
if !bc.StreamExists(id) {
log.Println("Creating stream: ", id)
bc.CreateStream(id)
}
bc.Publish(id, data)
case "build.create.done", "build.create.error", "build.delete.done", "build.delete.error", "build.import.done", "build.import.error", "environment.sync.done", "environment.sync.error":
bc.Publish(id, data)
Expand Down

0 comments on commit 5db7ded

Please sign in to comment.