mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
remove useless examples
This commit is contained in:
parent
40f1c43ccf
commit
49e57d36bb
@ -1,29 +0,0 @@
|
|||||||
# -*- coding: utf-8 -
|
|
||||||
#
|
|
||||||
# This file is part of grainbows released under the MIT license.
|
|
||||||
# See the NOTICE for more information.
|
|
||||||
|
|
||||||
import eventlet
|
|
||||||
import time
|
|
||||||
eventlet.monkey_patch(all=False, os=True, select=True, socket=True)
|
|
||||||
|
|
||||||
class TestIter(object):
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
lines = ['line 1\n', 'line 2\n']
|
|
||||||
for line in lines:
|
|
||||||
yield line
|
|
||||||
time.sleep(10)
|
|
||||||
|
|
||||||
def app(environ, start_response):
|
|
||||||
"""Application which cooperatively pauses 10 seconds before responding"""
|
|
||||||
data = 'Hello, World!\n'
|
|
||||||
status = '200 OK'
|
|
||||||
response_headers = [
|
|
||||||
('Content-type','text/plain'),
|
|
||||||
('Transfer-Encoding', "chunked"),
|
|
||||||
]
|
|
||||||
print 'request received'
|
|
||||||
start_response(status, response_headers)
|
|
||||||
return TestIter()
|
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -
|
# -*- coding: utf-8 -
|
||||||
#
|
#
|
||||||
# This file is part of grainbow released under the MIT license.
|
# This file is part of gunicorn released under the MIT license.
|
||||||
# See the NOTICE for more information.
|
# See the NOTICE for more information.
|
||||||
#
|
#
|
||||||
# Example code from Eventlet sources
|
# Example code from Eventlet sources
|
||||||
@ -8,7 +8,6 @@
|
|||||||
import collections
|
import collections
|
||||||
import errno
|
import errno
|
||||||
from grainbows.worker_base import ALREADY_HANDLED
|
from grainbows.worker_base import ALREADY_HANDLED
|
||||||
from eventlet import pools
|
|
||||||
import socket
|
import socket
|
||||||
import gevent
|
import gevent
|
||||||
from gevent.pool import Pool
|
from gevent.pool import Pool
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
# -*- coding: utf-8 -
|
# -*- coding: utf-8 -
|
||||||
#
|
#
|
||||||
# This file is part of grainbows released under the MIT license.
|
# This file is part of gunicorn released under the MIT license.
|
||||||
# See the NOTICE for more information.
|
# See the NOTICE for more information.
|
||||||
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
class TestIter(object):
|
class TestIter(object):
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
@ -1,13 +1,11 @@
|
|||||||
# -*- coding: utf-8 -
|
# -*- coding: utf-8 -
|
||||||
#
|
#
|
||||||
# This file is part of grainbows released under the MIT license.
|
# This file is part of gunicorn released under the MIT license.
|
||||||
# See the NOTICE for more information.
|
# See the NOTICE for more information.
|
||||||
|
|
||||||
from wsgiref.validate import validator
|
from wsgiref.validate import validator
|
||||||
|
|
||||||
import eventlet
|
import time
|
||||||
|
|
||||||
eventlet.monkey_patch(all=False, os=False, select=True, socket=True)
|
|
||||||
|
|
||||||
|
|
||||||
@validator
|
@validator
|
||||||
@ -19,6 +17,6 @@ def app(environ, start_response):
|
|||||||
('Content-type','text/plain'),
|
('Content-type','text/plain'),
|
||||||
('Content-Length', str(len(data))) ]
|
('Content-Length', str(len(data))) ]
|
||||||
print 'request received, pausing 10 seconds'
|
print 'request received, pausing 10 seconds'
|
||||||
eventlet.sleep(10)
|
time.sleep(10)
|
||||||
start_response(status, response_headers)
|
start_response(status, response_headers)
|
||||||
return iter([data])
|
return iter([data])
|
||||||
@ -1,4 +1,9 @@
|
|||||||
# -*- coding: utf-8 -
|
# -*- coding: utf-8 -
|
||||||
|
#
|
||||||
|
# This file is part of gunicorn released under the MIT license.
|
||||||
|
# See the NOTICE for more information.
|
||||||
|
#
|
||||||
|
# Example code from Eventlet sources
|
||||||
|
|
||||||
from wsgiref.validate import validator
|
from wsgiref.validate import validator
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
# -*- coding: utf-8 -
|
|
||||||
#
|
|
||||||
# This file is part of grainbows released under the MIT license.
|
|
||||||
# See the NOTICE for more information.
|
|
||||||
|
|
||||||
from wsgiref.validate import validator
|
|
||||||
|
|
||||||
|
|
||||||
def app(environ, start_response):
|
|
||||||
"""Application which cooperatively pauses 10 seconds before responding"""
|
|
||||||
data = 'Hello, World!\n'
|
|
||||||
status = '200 OK'
|
|
||||||
response_headers = [
|
|
||||||
('Content-type','text/plain'),
|
|
||||||
('Content-Length', str(len(data))) ]
|
|
||||||
start_response(status, response_headers)
|
|
||||||
return iter([data])
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -
|
# -*- coding: utf-8 -
|
||||||
#
|
#
|
||||||
# This file is part of grainbow released under the MIT license.
|
# This file is part of gunicorn released under the MIT license.
|
||||||
# See the NOTICE for more information.
|
# See the NOTICE for more information.
|
||||||
#
|
#
|
||||||
# Example code from Eventlet sources
|
# Example code from Eventlet sources
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import os
|
|||||||
|
|
||||||
import gevent
|
import gevent
|
||||||
from gevent import socket
|
from gevent import socket
|
||||||
from gevent.event import Event
|
|
||||||
from gevent.greenlet import Greenlet
|
from gevent.greenlet import Greenlet
|
||||||
from gevent.pool import Pool
|
from gevent.pool import Pool
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ class GEventWorker(KeepaliveWorker):
|
|||||||
def init_process(self):
|
def init_process(self):
|
||||||
super(GEventWorker, self).init_process()
|
super(GEventWorker, self).init_process()
|
||||||
self.pool = Pool(self.worker_connections)
|
self.pool = Pool(self.worker_connections)
|
||||||
#self.socket = socket.socket(_sock=self.socket)
|
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user