Skip to content

Commit

Permalink
Merge pull request #326 from isucon/backend/fix-isuapi-post-notificat…
Browse files Browse the repository at this point in the history
…ions

fix(bench, isuapi) ISUからIsuConditionにpostするデータが配列に変更されていなかったのを修正
  • Loading branch information
Nagarei authored Jul 9, 2021
2 parents cf93378 + 989a70d commit e765848
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions extra/jiaapi/cmd/standalone/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func (state *IsuConditionPoster) keepPosting(ctx context.Context) {
nowTime := time.Now()
randEngine.Seed(nowTime.UnixNano()/1000000000 + 961054102)

notification, err := json.Marshal(IsuNotification{
notification := IsuNotification{
IsSitting: (randEngine.Intn(100) <= 70),
Condition: fmt.Sprintf("is_dirty=%v,is_overweight=%v,is_broken=%v",
(randEngine.Intn(2) == 0),
Expand All @@ -340,7 +340,9 @@ func (state *IsuConditionPoster) keepPosting(ctx context.Context) {
),
Message: "今日もいい天気",
Timestamp: nowTime.Unix(),
})
}
notifications := []IsuNotification{notification}
payload, err := json.Marshal(notifications)
if err != nil {
log.Error(err)
continue
Expand All @@ -349,7 +351,7 @@ func (state *IsuConditionPoster) keepPosting(ctx context.Context) {
func() {
resp, err := http.Post(
targetURL, "application/json",
bytes.NewBuffer(notification),
bytes.NewBuffer(payload),
)
if err != nil {
log.Error(err)
Expand Down

0 comments on commit e765848

Please sign in to comment.