Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8469644a
Commit
8469644a
authored
Apr 05, 2022
by
Eduardo Bonet
Committed by
Alex Kalderimis
Apr 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "ActionView::Template::Error: 4:Deadline Exceeded."
Changelog: performance
parent
bb7d9a36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
lib/gitlab/diff/file.rb
lib/gitlab/diff/file.rb
+2
-2
spec/lib/gitlab/diff/file_spec.rb
spec/lib/gitlab/diff/file_spec.rb
+27
-3
No files found.
lib/gitlab/diff/file.rb
View file @
8469644a
...
...
@@ -375,7 +375,7 @@ module Gitlab
end
def
rendered
return
unless
use_renderable_diff?
&&
ipynb?
return
unless
use_renderable_diff?
&&
ipynb?
&&
modified_file?
&&
!
too_large?
strong_memoize
(
:rendered
)
{
Rendered
::
Notebook
::
DiffFile
.
new
(
self
)
}
end
...
...
@@ -410,7 +410,7 @@ module Gitlab
end
def
ipynb?
modified_file?
&&
file_path
.
ends_with?
(
'.ipynb'
)
file_path
.
ends_with?
(
'.ipynb'
)
end
# We can't use Object#try because Blob doesn't inherit from Object, but
...
...
spec/lib/gitlab/diff/file_spec.rb
View file @
8469644a
...
...
@@ -76,10 +76,34 @@ RSpec.describe Gitlab::Diff::File do
end
describe
'#rendered'
do
let
(
:commit
)
{
project
.
commit
(
"532c837"
)
}
context
'when not ipynb'
do
it
'is nil'
do
expect
(
diff_file
.
rendered
).
to
be_nil
end
end
context
'when ipynb'
do
let
(
:commit
)
{
project
.
commit
(
"532c837"
)
}
it
'creates a NotebookDiffFile for rendering'
do
expect
(
diff_file
.
rendered
).
to
be_kind_of
(
Gitlab
::
Diff
::
Rendered
::
Notebook
::
DiffFile
)
end
it
'creates a NotebookDiffFile for rendering'
do
expect
(
diff_file
.
rendered
).
to
be_kind_of
(
Gitlab
::
Diff
::
Rendered
::
Notebook
::
DiffFile
)
context
'when too large'
do
it
'is nil'
do
expect
(
diff
).
to
receive
(
:too_large?
).
and_return
(
true
)
expect
(
diff_file
.
rendered
).
to
be_nil
end
end
context
'when not modified'
do
it
'is nil'
do
expect
(
diff_file
).
to
receive
(
:modified_file?
).
and_return
(
false
)
expect
(
diff_file
.
rendered
).
to
be_nil
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment