deployment fix

This commit is contained in:
Samuel Tariku 2025-05-04 00:16:15 +03:00
parent b4e20a274d
commit 889427af26
7 changed files with 13 additions and 16 deletions

View File

@ -33,7 +33,7 @@ import (
)
// @title FortuneBet API
// @version 1.0
// @version 1.0.1
// @description This is server for FortuneBet.
// @termsOfService http://swagger.io/terms/
// @contact.name API Support

View File

@ -4932,7 +4932,7 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Version: "1.0.1",
Host: "",
BasePath: "",
Schemes: []string{},

View File

@ -13,7 +13,7 @@
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
"version": "1.0.1"
},
"paths": {
"/admin": {

View File

@ -1135,7 +1135,7 @@ info:
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: FortuneBet API
version: "1.0"
version: 1.0.1
paths:
/admin:
get:

View File

@ -100,14 +100,13 @@ func (s *service) FetchLiveEvents(ctx context.Context) error {
func (s *service) FetchUpcomingEvents(ctx context.Context) error {
sportIDs := []int{1, 18}
var totalPages int = 1
var page int = 0
var limit int = 100
var count int = 0
for _, sportID := range sportIDs {
var totalPages int = 1
var page int = 0
var limit int = 100
var count int = 0
for page != totalPages {
// time.Sleep(1 * time.Second) //This will restrict the fetching to 1200 requests per hour
time.Sleep(3 * time.Second) //This will restrict the fetching to 1200 requests per hour
page = page + 1
url := fmt.Sprintf("https://api.b365api.com/v1/bet365/upcoming?sport_id=%d&token=%s&page=%d", sportID, s.token, page)
@ -150,7 +149,6 @@ func (s *service) FetchUpcomingEvents(ctx context.Context) error {
}
skippedLeague := 0
for _, ev := range data.Results {
startUnix, _ := strconv.ParseInt(ev.Time, 10, 64)
// eventID, err := strconv.ParseInt(ev.ID, 10, 64)
// if err != nil {
@ -198,7 +196,6 @@ func (s *service) FetchUpcomingEvents(ctx context.Context) error {
break
}
count++
log.Printf("Skipped leagues %d", skippedLeague)
}
}

View File

@ -22,7 +22,7 @@ func New(token string, store *repository.Store) *ServiceImpl {
return &ServiceImpl{token: token, store: store}
}
// TODO this is only getting the main odds, this must be fixed
// TODO this is only getting the main odds, this must be fixed
func (s *ServiceImpl) FetchNonLiveOdds(ctx context.Context) error {
eventIDs, err := s.store.GetAllUpcomingEvents(ctx)
if err != nil {
@ -84,14 +84,13 @@ func (s *ServiceImpl) storeSection(ctx context.Context, eventID, fi, sectionName
if len(market.Odds) == 0 {
continue
}
marketRecord := domain.Market{
EventID: eventID,
FI: fi,
MarketCategory: sectionName,
MarketType: marketType,
MarketName: market.Name,
MarketID: market.ID,
MarketID: market.ID.String(),
UpdatedAt: updatedAt,
Odds: market.Odds,
}
@ -101,7 +100,7 @@ func (s *ServiceImpl) storeSection(ctx context.Context, eventID, fi, sectionName
}
type OddsMarket struct {
ID string `json:"id"`
ID json.Number `json:"id"`
Name string `json:"name"`
Odds []json.RawMessage `json:"odds"`
Header string `json:"header,omitempty"`

View File

@ -42,6 +42,7 @@ func (s *Service) FetchAndProcessResults(ctx context.Context) error {
s.logger.Error("Failed to fetch events")
return err
}
fmt.Printf("Expired Events: %d \n", len(events))
for _, event := range events {
eventID, err := strconv.ParseInt(event.ID, 10, 64)