allow a cllback in streamer
This commit is contained in:
1 parent
6e9c8212e2
commit
e87378b07f
4 files changed
+25
-22
No files matched your search
@@ -312,8 +312,8 @@ a:not(.btn):not(.noeffect):after {
|
|||||||
|
|
||||||
/*** accordion ***/
|
/*** accordion ***/
|
||||||
.accordion>label{cursor:pointer}
|
.accordion>label{cursor:pointer}
|
||||||
.accordion>input ~ label:before {content:"▲ "; color:#ddd}
|
.accordion>input ~ label:before {content:"\25b2"; color:#ddd}
|
||||||
.accordion>input:checked ~ label:before {content:"▼ "; color:#ddd}
|
.accordion>input:checked ~ label:before {content:"\25bc"; color:#ddd}
|
||||||
.accordion>input {display:none}
|
.accordion>input {display:none}
|
||||||
.accordion>input:checked ~ *:not(label) {
|
.accordion>input:checked ~ *:not(label) {
|
||||||
max-height: 1000px !important;
|
max-height: 1000px !important;
|
||||||
|
|||||||
+1
-1
Submodule gluon/packages/dal updated: 77e0d3f386...79ec4e99d0.
+19
-16
@@ -25,22 +25,25 @@ regex_stop_range = re.compile('(?<=\-)\d+')
|
|||||||
|
|
||||||
DEFAULT_CHUNK_SIZE = 64 * 1024
|
DEFAULT_CHUNK_SIZE = 64 * 1024
|
||||||
|
|
||||||
def streamer(stream, chunk_size=DEFAULT_CHUNK_SIZE, bytes=None):
|
def streamer(stream, chunk_size=DEFAULT_CHUNK_SIZE, bytes=None, callback=None):
|
||||||
offset = 0
|
try:
|
||||||
while bytes is None or offset < bytes:
|
offset = 0
|
||||||
if not bytes is None and bytes - offset < chunk_size:
|
while bytes is None or offset < bytes:
|
||||||
chunk_size = bytes - offset
|
if not bytes is None and bytes - offset < chunk_size:
|
||||||
data = stream.read(chunk_size)
|
chunk_size = bytes - offset
|
||||||
length = len(data)
|
data = stream.read(chunk_size)
|
||||||
if not length:
|
length = len(data)
|
||||||
break
|
if not length:
|
||||||
else:
|
break
|
||||||
yield data
|
else:
|
||||||
if length < chunk_size:
|
yield data
|
||||||
break
|
if length < chunk_size:
|
||||||
offset += length
|
break
|
||||||
stream.close()
|
offset += length
|
||||||
|
finally:
|
||||||
|
stream.close()
|
||||||
|
if callback:
|
||||||
|
callback()
|
||||||
|
|
||||||
def stream_file_or_304_or_206(
|
def stream_file_or_304_or_206(
|
||||||
static_file,
|
static_file,
|
||||||
|
|||||||
@@ -214,18 +214,18 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
/etc/init.d/nginx start
|
/etc/init.d/nginx start
|
||||||
start uwsgi-emperor
|
systemctl start emperor.uwsgi.service
|
||||||
|
|
||||||
echo <<EOF
|
echo <<EOF
|
||||||
you can stop uwsgi and nginx with
|
you can stop uwsgi and nginx with
|
||||||
|
|
||||||
sudo /etc/init.d/nginx stop
|
sudo /etc/init.d/nginx stop
|
||||||
sudo stop uwsgi-emperor
|
sudo systemctl start emperor.uwsgi.service
|
||||||
|
|
||||||
and start it with
|
and start it with
|
||||||
|
|
||||||
sudo /etc/init.d/nginx start
|
sudo /etc/init.d/nginx start
|
||||||
sudo start uwsgi-emperor
|
systemctl start emperor.uwsgi.service
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
Reference in new issue
Block a user