Skip to content

Commit

Permalink
small fix in the adding recent posts to the array
Browse files Browse the repository at this point in the history
we missed await to ensure there will be `index` before using that
  • Loading branch information
mahdiyari committed Jul 16, 2018
1 parent e3ee20d commit 87a1637
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stream_sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const insertPostToDb = async (author, permlink) => {
let exists = results[0]
for (let i in exists) exists = exists[i]
if (!exists) {
let index = postsIndex()
let index = await postsIndex()
posts[index] = post.id
await con.query(
'INSERT INTO `posts`' +
Expand Down Expand Up @@ -139,7 +139,7 @@ const insertCommentToDb = async (author, permlink) => {
let exists = results[0]
for (let i in exists) exists = exists[i]
if (!exists) {
let index = postsIndex()
let index = await postsIndex()
posts[index] = comment.id
await con.query(
'INSERT INTO `comments`' +
Expand Down

0 comments on commit 87a1637

Please sign in to comment.