-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sonarqube: fix duplicate in bench test
- Loading branch information
1 parent
19cf780
commit 4368d24
Showing
3 changed files
with
54 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package amqpnostorage | ||
|
||
import ( | ||
"context" | ||
"github.com/sirupsen/logrus" | ||
"github.com/surendratiwari3/paota/internal/config" | ||
"github.com/surendratiwari3/paota/internal/logger" | ||
"github.com/surendratiwari3/paota/workerpool" | ||
"os" | ||
) | ||
|
||
// UserRecord represents the structure of user records. | ||
type UserRecord struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Email string `json:"email"` | ||
// Add other fields as needed | ||
} | ||
|
||
func SetupWorkerPool() workerpool.Pool { | ||
logger.ApplicationLogger = logrus.StandardLogger() | ||
cnf := config.Config{ | ||
Broker: "amqp", | ||
TaskQueueName: "paota_task_queue", | ||
AMQP: &config.AMQPConfig{ | ||
Url: "amqp://localhost:55005/", | ||
Exchange: "paota_task_exchange", | ||
ExchangeType: "direct", | ||
BindingKey: "paota_task_binding_key", | ||
PrefetchCount: 100, | ||
ConnectionPoolSize: 10, | ||
}, | ||
} | ||
err := config.GetConfigProvider().SetApplicationConfig(cnf) | ||
if err != nil { | ||
logger.ApplicationLogger.Error("config error", err) | ||
return nil | ||
} | ||
newWorkerPool, err := workerpool.NewWorkerPool(context.Background(), 10, "testWorker") | ||
if err != nil { | ||
logger.ApplicationLogger.Error("workerPool is not created", err) | ||
os.Exit(0) | ||
} else if newWorkerPool == nil { | ||
logger.ApplicationLogger.Info("workerPool is nil") | ||
os.Exit(0) | ||
} | ||
logger.ApplicationLogger.Info("newWorkerPool created successfully") | ||
return newWorkerPool | ||
} |