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

                @has_been_initialized.value = true
            
            @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: =>
            clearTimeout @timeout
            @timeout = setTimeout @connect
            window.result = {}

            @query = @codemirror.getValue()
