diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-06-28 15:34:31 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-07-03 14:24:17 +0200 |
commit | f30089075fabfbac45c6382c0a2717bbb682734e (patch) | |
tree | 8864a5843ed5f6d1e0e079194def14682b1a9824 /db/schema.rb | |
parent | f25cdea64d69a97f31719622f9dead3de1ea0e11 (diff) | |
download | gitlab-ce-f30089075fabfbac45c6382c0a2717bbb682734e.tar.gz |
Fixed pagination of web hook logs
For reasons unknown, the logs of a web hook were paginated in memory.
This would result in the "Edit" page of a web hook timing out once it
has more than a few thousand log entries.
This commit makes the following changes:
1. We use LIMIT/OFFSET to paginate the data, instead of doing this in
memory.
2. We limit the logs to the last two days, just like the documentation
says (instead of retrieving everything).
3. We change the indexes on "web_hook_logs" so the query to get the data
can perform a backwards index scan, without the need for a Filter.
These changes combined ensure that Projects::HooksController#edit no
longer times out.
Diffstat (limited to 'db/schema.rb')
-rw-r--r-- | db/schema.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/db/schema.rb b/db/schema.rb index 0112fc726d4..38c1710d73c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180626125654) do +ActiveRecord::Schema.define(version: 20180628124813) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -2144,6 +2144,7 @@ ActiveRecord::Schema.define(version: 20180626125654) do t.datetime "updated_at", null: false end + add_index "web_hook_logs", ["created_at", "web_hook_id"], name: "index_web_hook_logs_on_created_at_and_web_hook_id", using: :btree add_index "web_hook_logs", ["web_hook_id"], name: "index_web_hook_logs_on_web_hook_id", using: :btree create_table "web_hooks", force: :cascade do |t| |