File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
pkg/pub_worker/lib/src/bin Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -131,9 +131,31 @@ Future<void> main(List<String> args) async {
131131 );
132132
133133 // sanity check on pana report size
134- final reportSize = gzip
134+ var reportSize = gzip
135135 .encode (utf8.encode (json.encode (summary.toJson ())))
136136 .length;
137+
138+ // Note: the new license coverage data seems to generate coverage pairs that
139+ // occupy way too much space. Until that bug is fixed, we should remove
140+ // that data from the summary.
141+ // TODO: remove this block once https://github.com/dart-lang/pana/issues/1481 gets fixed and deployed
142+ if (reportSize > _reportSizeDropThreshold) {
143+ // We are storing the licenses in two fields, removing the fallback/unused one.
144+ // ignore: deprecated_member_use
145+ summary.licenses? .clear ();
146+
147+ // Remove excessive range data.
148+ for (final l in summary.result? .licenses ?? < License > []) {
149+ final count = l.range? .coverages.length ?? 0 ;
150+ if (count > 50 ) {
151+ l.range? .coverages.removeRange (50 , count);
152+ }
153+ }
154+
155+ // re-calculate report size
156+ reportSize = gzip.encode (utf8.encode (json.encode (summary.toJson ()))).length;
157+ }
158+
137159 if (reportSize > _reportSizeDropThreshold) {
138160 summary = Summary (
139161 createdAt: summary.createdAt,
You can’t perform that action at this time.
0 commit comments