Преглед изворни кода

[RenderToPng fix] (#4901)

* removing useless code

* fix various minor typo

* don't silence phantomjs timeout and allow more time

* fix gofmt
fg2it пре 9 година
родитељ
комит
303cd8a5af
7 измењених фајлова са 6 додато и 7 уклоњено
  1. 0 1
      README.md
  2. 1 1
      build.go
  3. 1 1
      conf/defaults.ini
  4. 1 1
      conf/sample.ini
  5. 1 1
      pkg/api/render.go
  6. 2 0
      pkg/components/renderer/renderer.go
  7. 0 2
      tasks/options/phantomjs.js

+ 0 - 1
README.md

@@ -88,7 +88,6 @@ go get github.com/grafana/grafana
 ```
 ```
 
 
 ### Building the backend
 ### Building the backend
-Replace X.Y.Z by actual version number.
 ```bash
 ```bash
 cd $GOPATH/src/github.com/grafana/grafana
 cd $GOPATH/src/github.com/grafana/grafana
 go run build.go setup            (only needed once to install godep)
 go run build.go setup            (only needed once to install godep)

+ 1 - 1
build.go

@@ -136,7 +136,7 @@ func readVersionFromPackageJson() {
 			// add timestamp to iteration
 			// add timestamp to iteration
 			linuxPackageIteration = fmt.Sprintf("%s%v", linuxPackageIteration, time.Now().Unix())
 			linuxPackageIteration = fmt.Sprintf("%s%v", linuxPackageIteration, time.Now().Unix())
 		}
 		}
-		log.Println(fmt.Sprintf("teration %v", linuxPackageIteration))
+		log.Println(fmt.Sprintf("Iteration %v", linuxPackageIteration))
 	}
 	}
 }
 }
 
 

+ 1 - 1
conf/defaults.ini

@@ -248,7 +248,7 @@ mode = console, file
 # Buffer length of channel, keep it as it is if you don't know what it is.
 # Buffer length of channel, keep it as it is if you don't know what it is.
 buffer_len = 10000
 buffer_len = 10000
 
 
-# Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
+# Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Info"
 level = Info
 level = Info
 
 
 # For "console" mode only
 # For "console" mode only

+ 1 - 1
conf/sample.ini

@@ -230,7 +230,7 @@ check_for_updates = true
 # Buffer length of channel, keep it as it is if you don't know what it is.
 # Buffer length of channel, keep it as it is if you don't know what it is.
 ;buffer_len = 10000
 ;buffer_len = 10000
 
 
-# Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
+# Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Info"
 ;level = Info
 ;level = Info
 
 
 # For "console" mode only
 # For "console" mode only

+ 1 - 1
pkg/api/render.go

@@ -31,7 +31,7 @@ func RenderToPng(c *middleware.Context) {
 		Width:     queryReader.Get("width", "800"),
 		Width:     queryReader.Get("width", "800"),
 		Height:    queryReader.Get("height", "400"),
 		Height:    queryReader.Get("height", "400"),
 		SessionId: c.Session.ID(),
 		SessionId: c.Session.ID(),
-		Timeout:   queryReader.Get("timeout", "15"),
+		Timeout:   queryReader.Get("timeout", "30"),
 	}
 	}
 
 
 	renderOpts.Url = setting.ToAbsUrl(renderOpts.Url)
 	renderOpts.Url = setting.ToAbsUrl(renderOpts.Url)

+ 2 - 0
pkg/components/renderer/renderer.go

@@ -1,6 +1,7 @@
 package renderer
 package renderer
 
 
 import (
 import (
+	"fmt"
 	"io"
 	"io"
 	"os"
 	"os"
 	"os/exec"
 	"os/exec"
@@ -72,6 +73,7 @@ func RenderToPng(params *RenderOpts) (string, error) {
 		if err := cmd.Process.Kill(); err != nil {
 		if err := cmd.Process.Kill(); err != nil {
 			log.Error(4, "failed to kill: %v", err)
 			log.Error(4, "failed to kill: %v", err)
 		}
 		}
+		return "", fmt.Errorf("PhantomRenderer::renderToPng timeout (>%vs)", timeout)
 	case <-done:
 	case <-done:
 	}
 	}
 
 

+ 0 - 2
tasks/options/phantomjs.js

@@ -15,8 +15,6 @@ module.exports = function(config,grunt) {
         src = confDir+src;
         src = confDir+src;
       }
       }
 
 
-      var exec = require('child_process').execFileSync;
-
       try {
       try {
         grunt.config('copy.phantom_bin', {
         grunt.config('copy.phantom_bin', {
           src: src,
           src: src,