Open catatsuy opened 7 years ago
その人の投稿が見れる
ハッシュタグが見れる。URLは違うが、検索と同じsearchHandler
が呼び出されているのでこちらを最適化すれば良い。
別アプリケーション isutomo を叩いている。排除したい気持ちもあるが、ボトルネックになるまでは待つべき
isutomoを叩いている。jsonで返ってくる。フレンドのリストが返ってくる
curl http://localhost:8081/kazuto
{"friends":["kazuto","norihiko","tomio","hiroyuki","suguru","hiromitsu","atomu","masatomo","masato","ippei","sotaro","tadateru","nobuhiko","mitsunobu","hisatsugu","yoichi","masamori","mitsuhisa","kihei","ryotaro","akito","raizo","yasunari","shunichi","matsushige","yojiro","kiyosue","hidekazu","nobuhiro","shunji","tetsuharu","kiyohiro","munemori","kankuro","mitsumori","morihiko","shotaro","kazuro","suketoshi","hozumi","dai","reizo","shinya","akisada","nagatomo","seiichi","sadayoshi","hisayoshi","tadatsugu","koji","yoichiro","tadatoshi","taku","michio","takahide","eita","kiyoaki","takanori","hiroyoshi","kunitake","munetoki","toyokazu","teruyuki","mutsuo","tatsuhito","masahiro","masamura","toshio","toshinaga","akinobu","masayoshi","katsunari","takeyoshi","nagahide","soichiro","kaku","tomoya","sanji","taisuke","shinjo","mikio","taishi","teizo","norikazu","sadao","mitsuhira","taiichi","yasuyoshi","nobukatsu","shigefumi","masaya","kakichi","masanobu","tsunejiro","hayato","atsuya","tetsumasa","tadahito","sadaaki","daichi","kensuke","masahide","tateo","kazuaki","shusaku","ikko","kosei","yasuo","nobusada","tsutomu","kyohei","kenshin","toshimi","masakage","masabumi","shingo","takanobu","tetsuro","ryunosuke","shigenaga","haruto","takuji","masahisa","kaiji","hideyuki","shiryu","shigeki","yasuro","nagamichi","hideaki","ken","fumihiro","masatane","taiji","takauji","naohiro","masao","kento","kiyohide","tetsushi","masashige","mineo","takamitsu","mitsutaka","goro","yahiko","yoshi","munetoshi","seishiro","naokatsu","heihachiro","masachika","mitsuo","katsuteru","sakichi","tatsuhiro","taiki","michiharu","kenkichi","keiichi","toyoaki","kazunori","kiyokazu","yasuharu","tsuneyoshi","yasukazu","chikashi","takeharu","taizo","tamio","naganao","masaru","shoya","heisuke","jokichi","kunimitsu","mitsuyuki","tomohisa","kiyotake","tokujiro","torahiko","hideyo","seiki","matabei","kenichi","mitsuharu","okimoto","tadahiko","hirotami","norifusa","ryoichi","tatsuro","arinobu","tomotaka","takaaki","toshiyuki","ikki","akihiro","tatsumi","fumiaki","mitsuyoshi","yasuhide","kimio","tatsuyoshi","tsunenori","kagenori","yasunobu","hisao","yasufumi","taichi","jin","toyohiko","masatoshi","reiichi","mitsuomi","masamitsu","satoru","yasujiro","michiaki","daizo","kazushi","koki","naohiko","takafumi","mamoru","toshiya","naohisa","shigekazu","matsuki","sosuke","matsuo","takuya","junichi","hirokatsu","jushiro","hisamitsu","hironobu","katsutomo","asuka","yasuyuki","kuranosuke","katsunaga","motoki","shosuke","hirofumi","muneo","takehiko","tokuo","takuma","shuta","hidetsugu","nobutoshi","juzo","yasuaki","tadachika","katsuhito","tadanori","tadahiro","junki","akio","yanosuke","toshinari","takehito","ritsuo","toshimitsu","shogo","kunihiro","kunio","ikuro","takaya","yasutoshi","masanori","shinichi","tadatsune","michiro","ryuji","fumio","katsunosuke","terumasa","motoyuki","yoritaka","toshizo","tsunehisa","shunsuke","hisato","yasushi","munenobu","shichiro","mitsuteru","shohei","toshihide","sadatoshi","michihisa","yosuke","motoshige","naritaka","masakazu","keisuke","tokuro","koya","shuichi","sogen","ichiro","ryuta","shin","yasumasa","kohei","seizo","iesada","masatsugu","haruhiro","murashige","keizo","noriyuki","morio","motoharu","eiichi","katsushi","seishi","shozo","seijiro","katsutoshi","nobuyuki","ryusaku","einosuke","katsuei","michiya","arihiro","nobutsuna","kazuhiko","takayoshi","shigemitsu","hideto","masakatsu","shigeto","tsunemi","shiko","seiya","tadami","hidetoshi","motoyasu","ryoji","kiyonari","shigeyuki","giichi","tetsuo","mitsunori","munenori","hirotomo","shuji","morihiro","seikichi","kunimasa","toshiyasu","tatsuyuki","itaru","hisataka","taichiro","tatsuhiko","toshitada","ryuzo","takumi","jukichi","sho","yasuji","masuo","takao","takahiko","shigetada","naozumi","soji","genzo","shigehiro","michitaka","naofumi","yashiro","katsusuke","haruaki","tomohide","joji","mitsugu","teruyoshi","tomohito","kanemoto","umanosuke","kazuyuki","kaichi","morikazu","ryosuke","kazutoshi","kenyu","nobutoki","kazuhiro","jiichiro","mitsusuke","naoyuki","tomomichi","katsuji","kimiya","akishige","daishin","tsuneyuki","shinzo","kisho","kenjiro","kinichi","arata","munehiro","akitoshi","eishun","kaito","takuzo","takayuki","shinpei","naotake","hisanori","ryuki","yasuhiko","tomonori","junya","fusanosuke","hiroki","shunnosuke","osamu","mototsugu","tamotsu","bunji","toshimasa","kazuhito","hisamoto","haruhisa","masataka","ryutaro","norifumi","katsuhiro","yasutake","seiichiro","tetsuya","mineichi","naomori","tokio","kinichiro","katsuo","chikayoshi","kentaro","rikiya","nobuhisa","riichi","junichiro","hiroshige","masatake","shigetoshi","teruhisa","kuniaki","takejiro","kazuma","kuniyuki","kanetsugu","shigenobu","mitsuyo","gentaro","shigehisa","keijiro","shigeyoshi","masaki","keigo","haruo","takamori","shuko","takahito","mahiro","fumihiko","yasuhiro","kintaro","tokihiko","naomichi","nobuharu","hidemitsu","toyomatsu","kazuyoshi","akitsugu","masuzo","takeshi","isao","kosuke","atsushi","tomoyoshi","kunihiko","tatsushi","tomoyasu","tomoaki","takenori","iemasa","keishi","hidenobu","shunichiro","tadatomo","takeaki","junzo","junji","takuto"]}
GET /
を返すハンドラー。ページャーもあるのでGETクエリuntil
で日付を受け取れる。
SELECT * FROM tweets ORDER BY created_at DESC
# untilがある場合
SELECT * FROM tweets WHERE created_at < ? ORDER BY created_at DESC
loadFriends関数で友達のリストを取得する。上のSQLで全件取ってきているので、友達のリストをfor文で回して友達かどうか判定、友達ならappendしていく。perPage = 50
に達したら打ち切るので50件以上にはならない。
GET /search
GET /hashtag
を返すハンドラー。hashtagの方ならURLから、searchならGETクエリq
からクエリ名を取得してくる。
topHandler同様、untilが取れる。基本的に全件を取得してきてから
if strings.Index(t.HTML, query) != -1 {
tweets = append(tweets, &t)
}
で見てくる。perPage = 50に達したら打ち切るので50件以上にはならない。
untilも対応している
SELECT * FROM tweets WHERE user_id = ? ORDER BY created_at DESC
これをappendしているだけ。perPage = 50に達したら打ち切るので50件以上にはならない。LIMITサクッと付けたい
パス一覧
GET /
投稿が一覧できる。投稿もできる。もっと読むボタンが下にあり、投稿をもっと表示できる。 各ユーザーのページにフォロー・アンフォローボタンがある。フォローしている人の投稿が一覧できているっぽい。
GET /search
検索。めっちゃ重い。