Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Feature/inject urls for livestream" #415

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/internal/bencherror/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var ErrTimeout = errors.New("タイムアウトによりリクエスト失敗")
// ベンチマーカー本体由来のエラー

func NewInternalError(err error) error {
err = fmt.Errorf("[致命的なエラー]: %w", err)
err = fmt.Errorf("[ベンチ本体のエラー] スタッフにのみ表示されます: %w", err)
return WrapInternalError(SystemError, err)
}

Expand Down
25 changes: 2 additions & 23 deletions bench/internal/scheduler/reservation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package scheduler

import (
"log"
"math/rand"
"time"

"github.com/biogo/store/interval"
Expand All @@ -27,23 +26,6 @@ func ConvertFromIntInterface(i []interval.IntInterface) ([]*Reservation, error)
return reservations, nil
}

type ReservationUrls struct {
ThumbnailUrl string
PlaylistUrl string
}

var urls = []*ReservationUrls{
&ReservationUrls{ThumbnailUrl: "https://media.xiii.isucon.dev/BBB.webp", PlaylistUrl: "https://media.xiii.isucon.dev/bbb.m3u8"},
&ReservationUrls{ThumbnailUrl: "https://media.xiii.isucon.dev/timewarp.webp", PlaylistUrl: "https://media.xiii.isucon.dev/timewarp.m3u8"},
&ReservationUrls{ThumbnailUrl: "https://media.xiii.isucon.dev/yoru.webp", PlaylistUrl: "https://media.xiii.isucon.dev/yoru.m3u8"},
&ReservationUrls{ThumbnailUrl: "https://media.xiii.isucon.dev/isucon11_final.webp", PlaylistUrl: "https://media.xiii.isucon.dev/isucon11_final.m3u8"},
&ReservationUrls{ThumbnailUrl: "https://media.xiii.isucon.dev/isucon12_final_live.webp", PlaylistUrl: "https://media.xiii.isucon.dev/isucon12_final_live.m3u8"},
&ReservationUrls{ThumbnailUrl: "https://media.xiii.isucon.dev/isucon13.webp", PlaylistUrl: "https://media.xiii.isucon.dev/isucon13.m3u8"},
&ReservationUrls{ThumbnailUrl: "https://media.xiii.isucon.dev/isucon9.webp", PlaylistUrl: "https://media.xiii.isucon.dev/isucon9.m3u8"},
&ReservationUrls{ThumbnailUrl: "https://media.xiii.isucon.dev/hkd.webp", PlaylistUrl: "https://media.xiii.isucon.dev/hkd.m3u8"},
&ReservationUrls{ThumbnailUrl: "https://media.xiii.isucon.dev/ube.webp", PlaylistUrl: "https://media.xiii.isucon.dev/ube.m3u8"},
}

type Reservation struct {
// NOTE: id は、webappで割り振られるIDではなく、ReservationSchedulerが管理する上で利用するもの
id int
Expand All @@ -66,17 +48,14 @@ func mustNewReservation(id int, title string, description string, startAtStr str
log.Fatalln(err)
}

urlIdx := rand.Intn(len(urls))
url := urls[urlIdx]

reservation := &Reservation{
id: id,
Title: title,
Description: description,
StartAt: startAt.Unix(),
EndAt: endAt.Unix(),
PlaylistUrl: url.PlaylistUrl,
ThumbnailUrl: url.ThumbnailUrl,
PlaylistUrl: playlistUrl,
ThumbnailUrl: thumbnailUrl,
}

return reservation
Expand Down
18 changes: 9 additions & 9 deletions bench/internal/scheduler/reservation_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func mustNewReservationScheduler(baseAt int64, numSlots int64, hours int) *Reser

intervalTempertures, err := newIntervalTemperture(baseAt, numSlots, hours)
if err != nil {
lgr.Warnf("failed to initiate interval temperture: %s\n", err.Error())
lgr.Fatalf("failed to initiate interval temperture: %s\n", err.Error())
}
return &ReservationScheduler{
reservationPool: []*Reservation{},
Expand Down Expand Up @@ -126,7 +126,7 @@ func (r *ReservationScheduler) GetHotShortReservation() (*Reservation, error) {

reservations, err := ConvertFromIntInterface(founds)
if err != nil {
lgr.Warnf("GetHotShortReservation: failed to convert reservation: %s\n", err.Error())
lgr.Fatalf("GetHotShortReservation: failed to convert reservation: %s\n", err.Error())
return nil, err
}

Expand All @@ -142,7 +142,7 @@ func (r *ReservationScheduler) GetHotShortReservation() (*Reservation, error) {
}
}

lgr.Warn("GetHotShortReservation: failed to get reservation (not found)")
lgr.Fatal("GetHotShortReservation: failed to get reservation (not found)")
return nil, ErrNoReservation
}

Expand Down Expand Up @@ -171,7 +171,7 @@ func (r *ReservationScheduler) GetHotLongReservation() (*Reservation, error) {

reservations, err := ConvertFromIntInterface(founds)
if err != nil {
lgr.Warnf("GetHotLongReservation: failed to convert reservation: %s\n", err.Error())
lgr.Fatalf("GetHotLongReservation: failed to convert reservation: %s\n", err.Error())
return nil, err
}

Expand All @@ -187,7 +187,7 @@ func (r *ReservationScheduler) GetHotLongReservation() (*Reservation, error) {
}
}

lgr.Warn("GetHotLongReservation: failed to get reservation (not found)")
lgr.Fatal("GetHotLongReservation: failed to get reservation (not found)")
return nil, ErrNoReservation
}

Expand Down Expand Up @@ -216,7 +216,7 @@ func (r *ReservationScheduler) GetColdShortReservation() (*Reservation, error) {

reservations, err := ConvertFromIntInterface(founds)
if err != nil {
lgr.Warnf("GetColdShortReservation: failed to convert reservation: %s\n", err.Error())
lgr.Fatalf("GetColdShortReservation: failed to convert reservation: %s\n", err.Error())
return nil, err
}

Expand All @@ -233,7 +233,7 @@ func (r *ReservationScheduler) GetColdShortReservation() (*Reservation, error) {
}
}

lgr.Warn("GetColdShortReservation: failed to get reservation (not found)")
lgr.Fatal("GetColdShortReservation: failed to get reservation (not found)")
return nil, ErrNoReservation
}

Expand Down Expand Up @@ -262,7 +262,7 @@ func (r *ReservationScheduler) GetColdLongReservation() (*Reservation, error) {

reservations, err := ConvertFromIntInterface(founds)
if err != nil {
lgr.Warnf("GetColdLongReservation: failed to convert reservation: %s\n", err.Error())
lgr.Fatalf("GetColdLongReservation: failed to convert reservation: %s\n", err.Error())
return nil, err
}

Expand All @@ -279,7 +279,7 @@ func (r *ReservationScheduler) GetColdLongReservation() (*Reservation, error) {
}
}

lgr.Warn("GetColdLongReservation: failed to get reservation (not found)")
lgr.Fatal("GetColdLongReservation: failed to get reservation (not found)")
return nil, ErrNoReservation
}

Expand Down
4 changes: 4 additions & 0 deletions bench/isupipe/client_payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ func (c *Client) GetPaymentResult(ctx context.Context) (*PaymentResult, error) {
return nil, err
}

if err := ValidateResponse(req, paymentResp); err != nil {
return nil, err
}

return paymentResp, nil
}
Loading