From 0ad7a4162988eb243fdd5e27ac0093b1498f4682 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Tue, 9 Feb 2016 09:29:21 -0800 Subject: [PATCH] syntax fixes --- src/twtxt.nim | 10 ++++------ src/worker.nim | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/twtxt.nim b/src/twtxt.nim index 9dfa97c..1aea88a 100644 --- a/src/twtxt.nim +++ b/src/twtxt.nim @@ -10,7 +10,7 @@ type username*: string proc `$`*(t: Tweet): string = - return t.date.format(ISOTime) & "\t" & t.message + return t.date.format(ISOTime) & " " & t.message proc `%`*(t: Tweet): JsonNode = %* @@ -52,7 +52,7 @@ proc getTweetsFrom*(url: string, username: string): seq[Tweet] = let body = url.getContent(timeout=20_000) for line in body.splitLines().items(): - if line.len > 0 and line[0] != "#": + if line.len > 0 and line[0] != '#': res.add(username.parseTweet(line)) return res @@ -74,7 +74,5 @@ proc updateTweetsOnce*() {. gcsafe .} = for tweet in tweets.items(): try: db.exec(sql"insert into tweets values(null, ?, ?, ?);", username, tweet.date.timeInfoToTime().toSeconds().int(), tweet.message) - except: - echo getCurrentExceptionMsg() - except: - echo getCurrentExceptionMsg() + except: discard + except: discard diff --git a/src/worker.nim b/src/worker.nim index 5e9a8d3..58c63c5 100644 --- a/src/worker.nim +++ b/src/worker.nim @@ -31,6 +31,6 @@ proc updateSystemUser() = when isMainModule: while true: spawn updateTweetsOnce() - updateSystemUser() + spawn updateSystemUser() sleep 300_000 # 5 minutes