File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 1+ import weakref
2+
13import sentry_sdk
24from sentry_sdk .utils import ContextVar , logger
35from sentry_sdk .integrations import Integration
@@ -35,12 +37,24 @@ def processor(event, hint):
3537 if exc_info is None :
3638 return event
3739
40+ last_seen = integration ._last_seen .get (None )
41+ if last_seen is not None :
42+ # last_seen is either a weakref or the original instance
43+ last_seen = (
44+ last_seen () if isinstance (last_seen , weakref .ref ) else last_seen
45+ )
46+
3847 exc = exc_info [1 ]
39- if integration . _last_seen . get ( None ) is exc :
48+ if last_seen is exc :
4049 logger .info ("DedupeIntegration dropped duplicated error event %s" , exc )
4150 return None
4251
43- integration ._last_seen .set (exc )
52+ # we can only weakref non builtin types
53+ try :
54+ integration ._last_seen .set (weakref .ref (exc ))
55+ except TypeError :
56+ integration ._last_seen .set (exc )
57+
4458 return event
4559
4660 @staticmethod
You can’t perform that action at this time.
0 commit comments