title: 'async'/'await' in Node.js is not working in Node.js v8.1.0
body: <p>I am trying to flush the Redis cache database and return the status in the response. But before the cache is cleared it returns the response.</p>
  <p>In the below code the <em>console.log()</em> call will always print undefined since flushRedisDB is not awaited.</p>
  <p>My Node.js version is v8.1.0</p>
  <h3>File <em>myfile.js</em></h3>
  <pre><code>async function flushRedisapi(request, response)
  {
      try {
          var value = await redisModules.flushRedisDB();
          console.log(&quot;the value is: &quot; + value);
          if(value)
              response.status(200).send({status : 'Redis Cache Cleared'});
          else
              response.status(400).send({status : &quot;Redis Cache could not be flushed&quot;});
  
      } catch (error) {
          response.status(400).send({status : &quot;Redis Cache could not be flushed&quot;});
      }
  }
  </code></pre>
  <h3>File <em>redismodule.js</em></h3>
  <pre><code>var redisClient;        // Global (avoids duplicate connections)
  
  module.exports =
  {
      openRedisConnection : function()
      {
          if (redisClient == null)
          {
              redisClient = require(&quot;redis&quot;).createClient(6379, 'localhost');
              redisClient.selected_db = 1;
          }
      },
      isRedisConnectionOpened : function()
      {
          if (redisClient &amp;&amp; redisClient.connected == true)
          {
              return true;
          }
          else
          {
              if(redisClient)
                  redisClient.end();  // End and open once more
  
              module.exports.openRedisConnection();
  
              return true;
          }
      },
      flushRedisDB: async function()
      {
          if(!module.exports.isRedisConnectionOpened())
              return false;
  
          await redisClient.flushall(function (err, result)
          {
              return (result == 'OK') ? true : false;
          });
      }
  };
  </code></pre>
  <p>How can I solve this issue?</p>