@@ -23,36 +23,48 @@ JobRunner.prototype.run = function (job_id, callback) {
23
23
return callback ( err ) ;
24
24
}
25
25
26
- var query = job . getNextQuery ( ) ;
27
- var timeout = 12 * 3600 * 1000 ;
28
- if ( Number . isFinite ( global . settings . batch_query_timeout ) ) {
29
- timeout = global . settings . batch_query_timeout ;
30
- }
31
- if ( _ . isObject ( query ) ) {
32
- if ( Number . isFinite ( query . timeout ) && query . timeout > 0 ) {
33
- timeout = Math . min ( timeout , query . timeout ) ;
26
+ self . getQueryStatementTimeout ( job . data . user , function ( err , timeout ) {
27
+ if ( err ) {
28
+ return callback ( err ) ;
34
29
}
35
- query = query . query ;
36
- }
37
30
38
- try {
39
- job . setStatus ( jobStatus . RUNNING ) ;
40
- } catch ( err ) {
41
- return callback ( err ) ;
42
- }
31
+ var query = job . getNextQuery ( ) ;
43
32
44
- self . jobService . save ( job , function ( err , job ) {
45
- if ( err ) {
33
+ if ( _ . isObject ( query ) ) {
34
+ if ( Number . isFinite ( query . timeout ) && query . timeout > 0 ) {
35
+ timeout = Math . min ( timeout , query . timeout ) ;
36
+ }
37
+ query = query . query ;
38
+ }
39
+
40
+ try {
41
+ job . setStatus ( jobStatus . RUNNING ) ;
42
+ } catch ( err ) {
46
43
return callback ( err ) ;
47
44
}
48
45
49
- profiler . done ( 'running' ) ;
46
+ self . jobService . save ( job , function ( err , job ) {
47
+ if ( err ) {
48
+ return callback ( err ) ;
49
+ }
50
+
51
+ profiler . done ( 'running' ) ;
50
52
51
- self . _run ( job , query , timeout , profiler , callback ) ;
53
+ self . _run ( job , query , timeout , profiler , callback ) ;
54
+ } ) ;
52
55
} ) ;
53
56
} ) ;
54
57
} ;
55
58
59
+ JobRunner . prototype . getQueryStatementTimeout = function ( username , callback ) {
60
+ var timeout = 12 * 3600 * 1000 ;
61
+ if ( Number . isFinite ( global . settings . batch_query_timeout ) ) {
62
+ timeout = global . settings . batch_query_timeout ;
63
+ }
64
+
65
+ return callback ( null , timeout ) ;
66
+ } ;
67
+
56
68
JobRunner . prototype . _run = function ( job , query , timeout , profiler , callback ) {
57
69
var self = this ;
58
70
0 commit comments