Skip to content

Commit

Permalink
election_results の複数回コールを止める 33168
Browse files Browse the repository at this point in the history
  • Loading branch information
mickamy committed Jan 2, 2024
1 parent 0f75144 commit 6952689
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
15 changes: 15 additions & 0 deletions note.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,19 @@ docker exec -i ishocon2-bench-1 sh -c "./benchmark --ip app:443 --workload 6"
2024/01/02 04:27:13 投票者が結果を確認しています
2024/01/02 04:27:28 投票者の感心がなくなりました
2024/01/02 04:27:28 {"score": 28840, "success": 26120, "failure": 0}
```

- election_results の複数回コールを止める 33168

```
❯ make bench
docker exec -i ishocon2-bench-1 sh -c "./benchmark --ip app:443 --workload 6"
2024/01/02 04:29:00 Start GET /initialize
2024/01/02 04:29:01 期日前投票を開始します
2024/01/02 04:29:02 期日前投票が終了しました
2024/01/02 04:29:02 投票を開始します Workload: 6
2024/01/02 04:29:47 投票が終了しました
2024/01/02 04:29:47 投票者が結果を確認しています
2024/01/02 04:30:02 投票者の感心がなくなりました
2024/01/02 04:30:02 {"score": 33168, "success": 28584, "failure": 0}
```
7 changes: 4 additions & 3 deletions webapp/ruby/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def db_initialize

get '/' do
cs = []
election_results.each_with_index do |r, i|
er = election_results
er.each_with_index do |r, i|
# 上位10人と最下位のみ表示
cs.push(r) if i < 10 || 28 < i
end
Expand All @@ -113,12 +114,12 @@ def db_initialize
# parties_set.each do |party|
# parties[party] = 0
# end
election_results.each do |r|
er.each do |r|
parties[r[:political_party]] += r[:count] || 0
end

sex_ratio = { '男': 0, '女': 0 }
election_results.each do |r|
er.each do |r|
sex_ratio[r[:sex].to_sym] += r[:count] || 0
end

Expand Down

0 comments on commit 6952689

Please sign in to comment.