Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
Signed-off-by: denim2x <denim2x@cyberdude.com>
  • Loading branch information
denim2x committed Apr 27, 2019
1 parent b1e78bb commit 711ca3d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 0 additions & 2 deletions app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ env: flex
entrypoint: python3 main.py
runtime_config:
python_version: 3.7
automatic_scaling:
max_num_instances: 1
6 changes: 5 additions & 1 deletion engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from walrus import Database
from bareasgi import text_reader
from redis.exceptions import ResponseError

from util import *
from scraper import scrape, parse
Expand Down Expand Up @@ -87,7 +88,10 @@ async def respond(scope, info, matches, content):
url_db[res.name] = e['url']
docs.add(res.name)

db.bgsave()
try:
db.bgsave()
except ResponseError:
print("[WARN] Redis: command 'BGSAVE' failed")

answers = dialogflow.get_answers(text, filter=lambda a: a.source in docs)
if answers:
Expand Down
6 changes: 2 additions & 4 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ def realpath(path):
with open(realpath('config.yaml')) as f:
config = yaml.load(f, Loader=yaml.SafeLoader)

try:
from google.appengine.api import app_identity
project_id = app_identity.get_application_id()
except:
project_id = os.getenv('GOOGLE_CLOUD_PROJECT', None)
if not project_id:
with open(realpath('account.json')) as f:
_account = json.load(f)
project_id = _account['project_id']
Expand Down

0 comments on commit 711ca3d

Please sign in to comment.