소스 검색

[FIX] sleep time to load correct status

Gogs 7 년 전
부모
커밋
c95c7e34a9
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      api/utils/docker_api.py

+ 10 - 0
api/utils/docker_api.py

@@ -3,6 +3,7 @@ from __future__ import unicode_literals
 from django.conf import settings
 from docker import DockerClient
 from docker.errors import DockerException, NotFound, APIError
+import time
 
 '''
 '''
@@ -67,6 +68,9 @@ def start_container(id=None):
     try:
         container = client.containers.get(id)
         container.start()
+
+        time.sleep(1)
+
         container.reload()
 
         return {
@@ -96,6 +100,9 @@ def restart_container(id=None):
     try:
         container = client.containers.get(id)
         container.restart()
+
+        time.sleep(1)
+
         container.reload()
 
         return {
@@ -125,6 +132,9 @@ def stop_container(id=None):
     try:
         container = client.containers.get(id)
         container.stop()
+
+        time.sleep(1)
+
         container.reload()
 
         return {