Skip to content

Commit af3d074

Browse files
luki009fjsj
authored andcommitted
Add warning for default timeout in webpack_loader
Added warning for potential indefinite loading due to default timeout.
1 parent bcb49fd commit af3d074

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

webpack_loader/loaders.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535
'django_webpack_loader can\'t generate a nonce tag for a bundle, '
3636
'because the passed request doesn\'t contain a "csp_nonce". '
3737
'Chunk name: {chunk_name}')
38-
38+
_LOADER_POSSIBLE_LIMBO = (
39+
'You are using django_webpack_loader with default timeout "None" '
40+
'which can cause request to hang indefinitely. '
41+
'Validate status of webpack-stats.json file if you experience infinite loading.'
42+
)
3943

4044
@lru_cache(maxsize=100)
4145
def _get_netloc(url: str) -> str:
@@ -187,6 +191,10 @@ def get_bundle(self, bundle_name):
187191
time.sleep(self.config["POLL_INTERVAL"])
188192
if timeout and (time.time() - timeout > start):
189193
timed_out = True
194+
if not timeout:
195+
warn(
196+
message=_LOADER_POSSIBLE_LIMBO, category=RuntimeWarning
197+
)
190198
assets = self.get_assets()
191199

192200
if timed_out:

0 commit comments

Comments
 (0)