-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from MarkReedZ/loop_cleanup
Loop cleanup
- Loading branch information
Showing
56 changed files
with
3,700 additions
and
1,531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,9 @@ | |
*.swp | ||
settings.py | ||
build/* | ||
gbench/parse | ||
gbench/t | ||
gbench/string | ||
gbench/query | ||
.DS_Store | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
import aiomcache | ||
import uvloop | ||
|
||
from sanic import Sanic | ||
from sanic.response import text | ||
from sanic_session import Session, MemcacheSessionInterface | ||
|
||
app = Sanic("app") | ||
|
||
# create a memcache client | ||
client = aiomcache.Client("127.0.0.1", 11211) | ||
|
||
# pass the memcache client into the session | ||
session = Session(app, interface=MemcacheSessionInterface(client)) | ||
|
||
@app.route("/") | ||
async def test(request): | ||
# interact with the session like a normal dict | ||
if not request.ctx.session.get('foo'): | ||
request.ctx.session['foo'] = 0 | ||
|
||
request.ctx.session['foo'] += 1 | ||
|
||
response = text("YAY") | ||
|
||
return response | ||
|
||
if __name__ == "__main__": | ||
app.run(host="0.0.0.0", port=8000, debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
|
||
import sanic | ||
from sanic.response import json | ||
|
||
app = sanic.Sanic("my-hello-world-app") | ||
|
||
@app.route('/') | ||
async def test(request): | ||
return sanic.text("Hello World") | ||
return sanic.text("Hello World") | ||
|
||
@app.route("/s") | ||
async def sess(request): | ||
return sanic.text("session") | ||
|
||
if __name__ == '__main__': | ||
app.run(port=8080) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
|
||
for run in {1..1000} | ||
do | ||
curl -d "param1=value1¶m2=value2" -X POST http://localhost:8080/ -H "Content-Type: application/x-www-form-urlencoded" | ||
for n in {1..10}; do | ||
curl -d "param1=value1¶m2=value2" -X POST http://localhost:8080/form -H "Content-Type: application/x-www-form-urlencoded" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.