Chaosthebot / Chaos

A social coding experiment that updates its own code democratically.
http://chaosthebot.com
MIT License
2.44k stars 210 forks source link

Comment does not exist #527

Closed amoffat closed 7 years ago

amoffat commented 7 years ago
Traceback (most recent call last):
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 4949, in get_or_create
    return query.get(), False
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 3185, in get
    % self.sql())
lib.db.models.CommentDoesNotExist: Instance matching query does not exist:
SQL: SELECT "t1"."comment_id", "t1"."user_id", "t1"."text", "t1"."created_at", "t1"."updated_at" FROM "comment" AS t1 WHERE ((((("t1"."comment_id" = ?) AND ("t1"."user_id" = ?)) AND ("t1"."text" = ?)) AND ("t1"."created_at" = ?)) AND ("t1"."updated_at" = ?))
PARAMS: [306245135, 28798182, '> /vote close\n\nTime remaining: 0:00 - Vote status: passing :white_check_mark:', '2017-06-05T17:06:24Z', '2017-06-05T20:11:09Z']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "chaos.py", line 150, in <module>
    main()
  File "chaos.py", line 100, in main
    schedule.run_pending()
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/schedule/__init__.py", line 462, in run_pending
    default_scheduler.run_pending()
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/schedule/__init__.py", line 75, in run_pending
    self._run_job(job)
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/schedule/__init__.py", line 129, in _run_job
    ret = job.run()
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/schedule/__init__.py", line 377, in run
    ret = self.job_func()
  File "/root/workspace/Chaos/cron/__init__.py", line 13, in <lambda>
    lambda: poll_read_issue_comments(api))
  File "/root/workspace/Chaos/cron/poll_read_issue_comments.py", line 254, in poll_read_issue_comments
    handle_comment(api, cmd)
  File "/root/workspace/Chaos/cron/poll_read_issue_comments.py", line 169, in handle_comment
    post_command_status_update(api, cmd, has_votes)
  File "/root/workspace/Chaos/cron/poll_read_issue_comments.py", line 99, in post_command_status_update
    updated_at=resp["updated_at"])
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 4951, in get_or_create
    raise exc
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 4946, in get_or_create
    return cls.create(**params), True
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 4915, in create
    inst.save(force_insert=True)
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 5108, in save
    pk_from_cursor = self.insert(**field_dict).execute()
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 3526, in execute
    cursor = self._execute()
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 2912, in _execute
    return self.database.execute_sql(sql, params, self.require_commit)
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 3775, in execute_sql
    self.commit()
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 3598, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 135, in reraise
    raise value.with_traceback(tb)
  File "/root/.virtualenvs/chaos/lib/python3.6/site-packages/peewee.py", line 3768, in execute_sql
    cursor.execute(sql, params or ())
peewee.IntegrityError: UNIQUE constraint failed: comment.comment_id
PlasmaPower commented 7 years ago

Hmm that's the primary key... maybe we should do an insert or update?

PlasmaPower commented 7 years ago

The issue is actually an edited comment, I think. Creating a PR that should fix this.