Skip to content

Commit

Permalink
Instrumentation fixups.
Browse files Browse the repository at this point in the history
  • Loading branch information
dokterbob committed Oct 21, 2020
1 parent 5a203bb commit f566415
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 6 additions & 6 deletions commands/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ import (
"github.com/ipfs-search/ipfs-search/config"
"github.com/ipfs-search/ipfs-search/crawler"
"github.com/ipfs-search/ipfs-search/instr"

"github.com/ipfs-search/ipfs-search/queue/amqp"
)

// AddHash queues a single IPFS hash for indexing
func AddHash(ctx context.Context, cfg *config.Config, hash string) error {
instFlusher, err := instr.Install("ipfs-search-add")
if err != nil {
log.Fatal(err)
return err
}
defer instFlusher()

instrumentation := instr.New()
i := instr.New()

f := amqp.PublisherFactory{
AMQPURL: cfg.AMQP.AMQPURL,
Queue: "hashes",
AMQPURL: cfg.AMQP.AMQPURL,
Queue: "hashes",
Instrumentation: i,
}

queue, err := f.NewPublisher(ctx, instrumentation)
queue, err := f.NewPublisher(ctx)
if err != nil {
return err
}
Expand Down
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"github.com/ipfs-search/ipfs-search/commands"
"github.com/ipfs-search/ipfs-search/config"
"github.com/ipfs-search/ipfs-search/instr"
"gopkg.in/urfave/cli.v1"
"log"
"os"
Expand Down Expand Up @@ -67,8 +66,7 @@ func main() {
},
}

err = app.Run(os.Args)
if err != nil {
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
Expand Down

0 comments on commit f566415

Please sign in to comment.