                 @has_been_initialized.value = true
             
             @connect()
+            @timeout = setTimeout @connect
             window.r = rethinkdb.query
             window.R = r.R
-
-            @interval = setInterval @connect, 60*5*1000
 
             # We escape the last function because we are building a regex on top of it.
             @unsafe_to_safe_regexstr = []

            return tagged_callback

        execute_query: =>
            window.result = {}

            @query = @codemirror.getValue()

                window.conn.close()
            catch err
                #console.log 'Could not destroy connection'
            clearTimeout @timeout
    
    class @InputQuery extends Backbone.View
        className: 'query_control'
