Skip to content

Commit

Permalink
Disables benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
vladComan0 committed Oct 3, 2024
1 parent 2e51d58 commit 9add3b2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 51 deletions.
5 changes: 3 additions & 2 deletions cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"context"
"crypto/tls"
"database/sql"
"github.com/vladComan0/performance-analyzer/internal/model/repository"
"net/http"
"os"
"os/signal"
"strings"
"syscall"
"time"

"github.com/vladComan0/performance-analyzer/internal/model/repository"

"github.com/rs/zerolog"
"github.com/vladComan0/performance-analyzer/internal/config"
"github.com/vladComan0/performance-analyzer/internal/service"
Expand Down Expand Up @@ -132,7 +133,7 @@ func configureLogger(cfg config.Config) zerolog.Logger {

func (app *application) cleanup(db *sql.DB, server *http.Server) {
interruptChan := make(chan os.Signal, 1)
signal.Notify(interruptChan, os.Interrupt, os.Kill, syscall.SIGINT, syscall.SIGTERM)
signal.Notify(interruptChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)

sig := <-interruptChan

Expand Down
91 changes: 42 additions & 49 deletions internal/model/entity/worker_test.go
Original file line number Diff line number Diff line change
@@ -1,54 +1,47 @@
package entity

import (
"github.com/rs/zerolog"
"sync"
"testing"
"time"
)
// func BenchmarkChannelApproach(b *testing.B) {
// env := &Environment{
// ID: 8,
// Name: "Meli",
// Disabled: false,
// TokenEndpoint: "http://localhost:8080/token",
// BasicAuthToken: "Basic YWR",
// Endpoint: "https://youtube.com",
// CreatedAt: time.Now(),
// }
// for i := 0; i < b.N; i++ {
// worker := NewWorker(5, 50, 100, "GET", nil, env, zerolog.Logger{})

func BenchmarkChannelApproach(b *testing.B) {
env := &Environment{
ID: 8,
Name: "Meli",
Disabled: false,
TokenEndpoint: "http://localhost:8080/token",
BasicAuthToken: "Basic YWR",
Endpoint: "https://youtube.com",
CreatedAt: time.Now(),
}
for i := 0; i < b.N; i++ {
worker := NewWorker(5, 50, 100, "GET", nil, env, zerolog.Logger{})
// wg := &sync.WaitGroup{}
// // Start the worker
// worker.Start(wg, func(id int, status Status) error {
// return nil
// }, func(id int, metrics *Metrics) error {
// return nil
// })
// }
// }

wg := &sync.WaitGroup{}
// Start the worker
worker.Start(wg, func(id int, status Status) error {
return nil
}, func(id int, metrics *Metrics) error {
return nil
})
}
}
// func BenchmarkTraditionalApproach(b *testing.B) {
// env := &Environment{
// ID: 8,
// Name: "Meli",
// Disabled: false,
// TokenEndpoint: "http://localhost:8080/token",
// BasicAuthToken: "Basic YWR",
// Endpoint: "https://youtube.com",
// CreatedAt: time.Now(),
// }
// for i := 0; i < b.N; i++ {
// worker := NewWorker(5, 50, 100, "GET", nil, env, zerolog.Logger{})

func BenchmarkTraditionalApproach(b *testing.B) {
env := &Environment{
ID: 8,
Name: "Meli",
Disabled: false,
TokenEndpoint: "http://localhost:8080/token",
BasicAuthToken: "Basic YWR",
Endpoint: "https://youtube.com",
CreatedAt: time.Now(),
}
for i := 0; i < b.N; i++ {
worker := NewWorker(5, 50, 100, "GET", nil, env, zerolog.Logger{})

wg := &sync.WaitGroup{}
// Start the worker
worker.Start2(wg, func(id int, status Status) error {
return nil
}, func(id int, metrics *Metrics) error {
return nil
})
}
}
// wg := &sync.WaitGroup{}
// // Start the worker
// worker.Start2(wg, func(id int, status Status) error {
// return nil
// }, func(id int, metrics *Metrics) error {
// return nil
// })
// }
// }

0 comments on commit 9add3b2

Please sign in to comment.