Commit Graph

86 Commits

Author SHA1 Message Date
80cfa2f815 useless: fix syntax warning
storage: shorten code
2020-03-16 22:04:29 +00:00
e03f5d0a43 add auto reconnect for postgres
This only works on the second database interaction, since psycopg2 only notices that
the connection is gone, when a query is executed.

So in the common case reconnect works as follows:
- some bot method calls a cursor function like .execute(), .fetchone(), etc.
  - this raises an error if the connection is broken
  - if following code then requests a new cursor, this will also fail since psycopg2
    now knows that the connection is gone
  - the error is caught in storage.DBConn.cursor(), a new connection will be set up
    of which a new cursor is yielded
If the error happens in connection.commit() or .rollback() instead we can instantly
reconnect since these methods are wrapped.

So why not wrap the cursor methods as well?
Consider the following example:
A query is the last thing that was executed on a cursor.
The database connection is lost.
Now .fetchone() is called on the cursor.
We could wrap .fetchone() and reconnect, but we'd have to use a new cursor since
cursors are linked to connections. And on this new cursor .fetchone() wouldn't
make any sense, since we haven't executed a query on this cursor.
2020-03-16 21:51:32 +00:00
84396cad99 quotes: add global searching 2019-12-08 22:04:04 +00:00
db797b4fef quotes: add quote searching 2019-12-08 19:35:10 +00:00
81c22bf6a4 utils: remove unused import of pprint 2019-12-08 19:33:56 +00:00
4a11ea497e add flash to REE regex 2019-09-19 19:24:06 +00:00
Flummi
9388a39291 lowfry deep fried 2019-07-16 13:47:19 +00:00
Flummi
c8cb1f0fa6 pls don't throw any errors. 2019-04-24 17:48:19 +00:00
7255dd4735 fix debian/ubuntu/apt/dpkg regex
now doesn't match words like laptop, with 'apt' inside, anymore
2018-12-17 15:03:22 +00:00
1dac1571e2 remove +R, add +B on connect
add .iframe command
2018-12-10 16:04:59 +00:00
c36569d33d
fix ree regex 2018-08-14 12:52:58 +02:00
6b1c3a4e8f
add a lot of useless and ascii commands 2018-08-14 01:07:57 +02:00
1e13cb5a37 Set 'currency' to 'usd' if fallback has been used 2017-10-15 04:03:30 +02:00
4da84cb452 Add 'usd' fallback to coin data request 2017-10-15 04:00:31 +02:00
a08d5f07dc Add currency information to 'no data received' message 2017-10-15 03:56:19 +02:00
f02e90ecd8 Fix data request for coins 2017-10-15 03:51:12 +02:00
0c7697e33b Move __currency out of Coins class 2017-10-15 03:49:08 +02:00
3f6c840d86 Fix Coins.__currency call 2017-10-15 03:44:55 +02:00
a0575a4826 retab? maybe 2017-10-15 03:42:18 +02:00
023ac72be6 Add @staticmethod to __currency 2017-10-15 03:40:00 +02:00
ddf1d18a92 Move __currency into Coins class 2017-10-15 03:37:49 +02:00
180825dfe1 Fix __currency 2017-10-15 03:34:23 +02:00
6a508420ed Proper pre- or suffix for currencies 2017-10-15 03:23:31 +02:00
e00636de02 Set eur as default currency in coins module 2017-10-15 02:48:58 +02:00
Flummi
e8a2b32f41 lower! 2017-09-29 11:34:16 +00:00
Flummi
1aed3bb746 monreo -> monero 2017-09-21 17:15:23 +02:00
Flummi
7c08047780 Update coins.py 2017-09-21 10:56:21 +00:00
Flummi
bbd2c65338 oops :o 2017-09-21 09:39:01 +00:00
Flummi
d3b01bcf97 added Monreo 2017-09-21 04:08:50 +00:00
mrhanky
09be12eed8
Added .meth command 2017-09-06 13:06:21 +02:00
mrhanky
90035a8249
Formattings dopes code and renaming the module 2017-09-06 13:01:05 +02:00
3dd02bb94d Fix actions 2017-09-05 22:00:40 +02:00
dacbf44d44 Dope module 2017-09-05 21:54:47 +02:00
mrhanky
a029c47a61
Again lower() bug lel 2017-09-05 19:55:41 +02:00
Cephra
0c80766098 now with .format :D 2017-08-23 13:01:19 +02:00
Cephra
8eaffb0b99 changed to .notice 2017-08-23 12:59:00 +02:00
Cephra
3c38c5055e added feedback 2017-08-23 12:49:17 +02:00
mrhanky
3a7bb88a7d
Fixed rape 2017-08-22 21:20:43 +02:00
mrhanky
deb8c3b985
Uppercased sql statements 2017-08-22 20:05:32 +02:00
mrhanky
8ffb00ad58
Using env_file var now 2017-08-22 19:01:33 +02:00
mrhanky
f341503101
Auto setting conf.debug=True if env var BOT_DEV is set 2017-08-22 18:10:58 +02:00
mrhanky
4c02227c4b
Removed unused logger 2017-08-22 18:07:38 +02:00
mrhanky
ac7b333ccf
Called wrong function in Admin.part 2017-08-22 18:04:02 +02:00
mrhanky
e9f10db2c5
Added persistent join/part 2017-08-22 18:02:33 +02:00
mrhanky
f33a17038a
Huge cleanup and refactoring :> 2017-08-22 17:43:48 +02:00
mrhanky
7f5571fc09
Moved @irc3.plugin into bot.plugins.BasePlugin -> saved some lines 2017-08-22 16:47:10 +02:00
mrhanky
1939635cdb
Added admin functions (atm non-persistent 2017-08-22 16:46:33 +02:00
mrhanky
4fa23eacc9
Added .hw alias and .spit 2017-08-22 16:23:54 +02:00
mrhanky
a931d31e39
CONSISTENCY! Removed all dots in docs, removed blank lines and useless try/except, uppercased all sql statements 2017-08-22 16:15:52 +02:00
mrhanky
6f36c7ed9f
Ups... 2017-08-22 16:00:03 +02:00