Commit graph

24 commits

Author SHA1 Message Date
gfyoung
d598e4fd93 Enable more frozen string in lib/**/*.rb
Enables frozen for the following:

* lib/*.rb
* lib/banzai/**/*.rb
* lib/bitbucket/**/*.rb
* lib/constraints/**/*.rb
* lib/container_registry/**/*.rb
* lib/declarative_policy/**/*.rb

Partially addresses #47424.
2018-10-06 17:02:50 -07:00
Jacopo
181cd299f9 Adds Rubocop rule for line break after guard clause
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
2017-11-16 17:58:29 +01:00
Francisco Javier López
bf0331dc72 Resolve "DashboardController#activity.json is slow due to SQL" 2017-11-06 16:52:56 +00:00
Toon Claes
d13669716a Create idea of read-only database
In GitLab EE, a GitLab instance can be read-only (e.g. when it's a Geo
secondary node). But in GitLab CE it also might be useful to have the
"read-only" idea around. So port it back to GitLab CE.

Also having the principle of read-only in GitLab CE would hopefully
lead to less errors introduced, doing write operations when there
aren't allowed for read-only calls.

Closes gitlab-org/gitlab-ce#37534.
2017-10-06 22:37:40 +02:00
Tiago Botelho
6d8e102c74 Adds cacheless render to Banzai object render 2017-09-06 15:35:35 +01:00
Robert Speicher
260c8da060 Whitelist or fix additional Gitlab/PublicSend cop violations
An upcoming update to rubocop-gitlab-security added additional
violations.
2017-08-14 12:14:11 -04:00
Robert Speicher
01dc8e6d66 Don't bother going through an entire Banzai pipeline for empty text
This bails out of `cacheless_render` immediately unless the provided
text is present, since there's no point.

This is a slight improvement in our test performance. Across the
creation of 1,000 `Namespace` records, which caches the `description`
field and which is blank by default in its factory, this saves about
four seconds, which... sure. Why not.
2017-08-03 22:48:51 -04:00
Nick Thomas
d2b883b750 Start versioning cached markdown fields 2017-04-21 17:24:33 +01:00
Nick Thomas
bc14c4f03b Remove a use of module_function 2017-04-21 11:52:28 +01:00
Jarka Kadlecova
bf708e55c2 make mentions working when project not specified 2017-01-18 18:38:17 -05:00
Nick Thomas
251a20a30d Split out markdown cache storage into a separate method 2016-11-04 04:00:14 +00:00
Yorick Peterse
c5bf8e362c
Use module_function in Banzai::Renderer
Using `extend self` prevents GitLab Performance Monitoring from being
able to track class methods.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23347
2016-10-14 16:24:02 +02:00
Nick Thomas
e94cd6fdfe Add markdown cache columns to the database, but don't use them yet
This commit adds a number of _html columns and, with the exception of Note,
starts updating them whenever the content of their partner fields changes.

Note has a collision with the note_html attr_accessor; that will be fixed later

A background worker for clearing these cache columns is also introduced - use
`rake cache:clear` to set it off. You can clear the database or Redis caches
separately by running `rake cache:clear:db` or `rake cache:clear:redis`,
respectively.
2016-10-07 02:54:25 +01:00
Grzegorz Bizon
f281041fea Make banzai module that handles markdown singleton 2016-07-19 15:12:15 +02:00
Paco Guzman
cc752f241c ObjectRenderer doesn't crash when no objects to cache with Rails.cache.read_multi 2016-07-13 11:19:21 +02:00
Paco Guzman
3d2c540db6 Object renderer read_multi rendered entries from Cache 2016-07-12 14:35:29 +02:00
Yorick Peterse
d9a4ca5975
Move pre_process into render_result
The method Banzai::Renderer.pre_process would always be called,
regardless of whether the Markdown to render was already cached or not.
In cache the document _was_ cached the output of the pre-processing
pipeline was ignored resulting in it doing nothing but wasting CPU
cycles.

This commit moves Banzai::Renderer.pre_process into
Banzai::Renderer.render_result so that it's _only_ used when needed.
2016-06-21 17:39:01 +02:00
Yorick Peterse
935f913165
Instrument Banzai code 2016-04-11 17:43:12 +02:00
Robert Speicher
74751791a8 Add a PreProcessPipeline 2016-03-02 22:19:36 -05:00
Douwe Maan
cf19efec3a Revert "Temporarily disable Markdown caching"
This reverts commit d337d5e713.
2016-01-06 13:26:02 +01:00
Douwe Maan
b9ed3961b5 Revert "Add DEBUG_BANZAI_CACHE env var to debug Banzai cache issue."
This reverts commit 4b027bc93a.
2016-01-06 13:25:13 +01:00
Douwe Maan
4b027bc93a Add DEBUG_BANZAI_CACHE env var to debug Banzai cache issue. 2016-01-04 14:30:30 +01:00
Douwe Maan
d337d5e713 Temporarily disable Markdown caching 2015-12-16 18:50:06 +01:00
Douwe Maan
7781bda9bd Move Markdown/reference logic from Gitlab::Markdown to Banzai 2015-12-15 15:51:16 +01:00