Commit Graph

28 Commits

Author SHA1 Message Date
b267f3a3ac Add latest changes from gitlab-org/gitlab@master 2021-10-28 18:14:18 +00:00
53288eeb63 Add latest changes from gitlab-org/gitlab@master 2020-05-05 21:09:42 +00:00
cea7ba513c Rename Redactor classes to ReferenceRedactor 2019-07-16 20:19:08 +00:00
e5705f5c54 Banzai - avoid redis if attr is in DB cache
When cache_collection_render runs we end up reading and writing
things to redis even if we already have the rendered field cached
in the DB. This commit avoids using redis at all whenever we have
the field already rendered in the DB cache.
2019-07-10 21:35:43 -06:00
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
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
bf0331dc72 Resolve "DashboardController#activity.json is slow due to SQL" 2017-11-06 16:52:56 +00:00
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
6d8e102c74 Adds cacheless render to Banzai object render 2017-09-06 15:35:35 +01:00
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
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
d2b883b750 Start versioning cached markdown fields 2017-04-21 17:24:33 +01:00
bc14c4f03b Remove a use of module_function 2017-04-21 11:52:28 +01:00
bf708e55c2 make mentions working when project not specified 2017-01-18 18:38:17 -05:00
251a20a30d Split out markdown cache storage into a separate method 2016-11-04 04:00:14 +00:00
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
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
f281041fea Make banzai module that handles markdown singleton 2016-07-19 15:12:15 +02:00
cc752f241c ObjectRenderer doesn't crash when no objects to cache with Rails.cache.read_multi 2016-07-13 11:19:21 +02:00
3d2c540db6 Object renderer read_multi rendered entries from Cache 2016-07-12 14:35:29 +02:00
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
935f913165 Instrument Banzai code 2016-04-11 17:43:12 +02:00
74751791a8 Add a PreProcessPipeline 2016-03-02 22:19:36 -05:00
cf19efec3a Revert "Temporarily disable Markdown caching"
This reverts commit d337d5e713.
2016-01-06 13:26:02 +01:00
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
4b027bc93a Add DEBUG_BANZAI_CACHE env var to debug Banzai cache issue. 2016-01-04 14:30:30 +01:00
d337d5e713 Temporarily disable Markdown caching 2015-12-16 18:50:06 +01:00
7781bda9bd Move Markdown/reference logic from Gitlab::Markdown to Banzai 2015-12-15 15:51:16 +01:00