mirror of https://github.com/openspug/spug
fix issue
parent
162680e64b
commit
c078f9aa5d
|
@ -135,8 +135,8 @@ class RequestDetailView(View):
|
|||
rds, key, counter = get_redis_connection(), f'{settings.REQUEST_KEY}:{r_id}', 0
|
||||
data = rds.lrange(key, counter, counter + 9)
|
||||
while data:
|
||||
counter += 10
|
||||
for item in data:
|
||||
counter += 1
|
||||
item = json.loads(item.decode())
|
||||
if 'data' in item:
|
||||
outputs[item['key']]['data'] += item['data']
|
||||
|
@ -145,6 +145,7 @@ class RequestDetailView(View):
|
|||
if 'status' in item:
|
||||
outputs[item['key']]['status'] = item['status']
|
||||
data = rds.lrange(key, counter, counter + 9)
|
||||
response['index'] = counter
|
||||
return json_response(response)
|
||||
|
||||
def post(self, request, r_id):
|
||||
|
|
|
@ -82,7 +82,6 @@ class SSH:
|
|||
exit_code, line = -1, ''
|
||||
while True:
|
||||
line = channel.recv(8196).decode()
|
||||
print(repr(line))
|
||||
match = self.regex.search(line)
|
||||
if match:
|
||||
exit_code = int(line.rsplit()[-1])
|
||||
|
|
|
@ -26,7 +26,7 @@ function Ext1Console(props) {
|
|||
Object.assign(outputs, res.outputs)
|
||||
setTimeout(() => setFetching(false), 100)
|
||||
if (res.status === '2') {
|
||||
socket = _makeSocket()
|
||||
socket = _makeSocket(res.index)
|
||||
}
|
||||
})
|
||||
return () => socket && socket.close()
|
||||
|
@ -44,8 +44,7 @@ function Ext1Console(props) {
|
|||
return () => socket && socket.close()
|
||||
}
|
||||
|
||||
function _makeSocket() {
|
||||
let index = 0;
|
||||
function _makeSocket(index = 0) {
|
||||
const token = props.request.id;
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const socket = new WebSocket(`${protocol}//${window.location.host}/api/ws/request/${token}/?x-token=${X_TOKEN}`);
|
||||
|
|
|
@ -30,7 +30,7 @@ function Ext2Console(props) {
|
|||
Object.assign(outputs, res.outputs);
|
||||
setTimeout(() => setFetching(false), 100)
|
||||
if (res.status === '2') {
|
||||
socket = _makeSocket()
|
||||
socket = _makeSocket(res.index)
|
||||
}
|
||||
})
|
||||
return () => socket && socket.close()
|
||||
|
@ -49,8 +49,7 @@ function Ext2Console(props) {
|
|||
return () => socket && socket.close()
|
||||
}
|
||||
|
||||
function _makeSocket() {
|
||||
let index = 0;
|
||||
function _makeSocket(index = 0) {
|
||||
const token = props.request.id;
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const socket = new WebSocket(`${protocol}//${window.location.host}/api/ws/request/${token}/?x-token=${X_TOKEN}`);
|
||||
|
|
Loading…
Reference in New Issue