Implemented the integration with scraper python server, tenders summarise, and some fixes.

This commit is contained in:
Mazyar
2025-12-27 12:47:08 +03:30
parent e4da3b5bb2
commit f6bdcc6d7c
18 changed files with 1054 additions and 45 deletions
+11 -5
View File
@@ -3,6 +3,7 @@ package minio
import (
"context"
"net/http"
"time"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
@@ -36,6 +37,8 @@ func (cm *ConnectionManager) Connect() error {
Region: cm.config.Region,
Transport: &http.Transport{
ResponseHeaderTimeout: cm.config.RequestTimeout,
TLSHandshakeTimeout: 10 * time.Second,
DisableKeepAlives: false,
},
})
if err != nil {
@@ -48,14 +51,16 @@ func (cm *ConnectionManager) Connect() error {
cm.client = minioClient
// Test connection by listing buckets
ctx, cancel := context.WithTimeout(context.Background(), cm.config.ConnectTimeout)
// Test connection by checking if we can reach the server
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
_, err = cm.client.ListBuckets(ctx)
// Try bucket exists check with shorter timeout
exists, err := cm.client.BucketExists(ctx, cm.config.DefaultBucket)
if err != nil {
cm.logger.Error("Failed to connect to MinIO", map[string]interface{}{
"endpoint": cm.config.Endpoint,
"bucket": cm.config.DefaultBucket,
"error": err.Error(),
})
return NewErrorWithCause(ErrCodeConnectionFailed, "failed to connect to MinIO", err)
@@ -64,8 +69,9 @@ func (cm *ConnectionManager) Connect() error {
cm.logger.Info("Successfully connected to MinIO", map[string]interface{}{
"endpoint": cm.config.Endpoint,
"region": cm.config.Region,
"bucket": cm.config.DefaultBucket,
"exists": exists,
})
return nil
}
@@ -240,7 +246,7 @@ func (cm *ConnectionManager) GetBucketInfo(ctx context.Context, bucketName strin
// For now, return basic bucket info
// In a real implementation, you might want to get more detailed info
info := map[string]interface{}{
"name": bucketName,
"name": bucketName,
"region": cm.config.Region,
}