Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
clients
python
sakia
Commits
4a1c5f2c
Commit
4a1c5f2c
authored
Mar 14, 2015
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bugs in person caching
- Error when an exception was raised - Interblocking because of missing finally clause
parent
e49c2887
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cutecoin/core/person.py
+25
-19
25 additions, 19 deletions
src/cutecoin/core/person.py
with
25 additions
and
19 deletions
src/cutecoin/core/person.py
+
25
−
19
View file @
4a1c5f2c
...
@@ -11,7 +11,7 @@ from ucoinpy.api import bma
...
@@ -11,7 +11,7 @@ from ucoinpy.api import bma
from
ucoinpy
import
PROTOCOL_VERSION
from
ucoinpy
import
PROTOCOL_VERSION
from
ucoinpy.documents.certification
import
SelfCertification
from
ucoinpy.documents.certification
import
SelfCertification
from
ucoinpy.documents.membership
import
Membership
from
ucoinpy.documents.membership
import
Membership
from
cutecoin
.tools.exceptions
import
PersonNotFoundError
,
\
from
.
.tools.exceptions
import
Error
,
PersonNotFoundError
,
\
MembershipNotFoundError
MembershipNotFoundError
from
PyQt5.QtCore
import
QMutex
from
PyQt5.QtCore
import
QMutex
...
@@ -51,6 +51,8 @@ class cached(object):
...
@@ -51,6 +51,8 @@ class cached(object):
except
KeyError
:
except
KeyError
:
value
=
self
.
func
(
inst
,
community
)
value
=
self
.
func
(
inst
,
community
)
inst
.
_cache
[
community
.
currency
][
self
.
func
.
__name__
]
=
value
inst
.
_cache
[
community
.
currency
][
self
.
func
.
__name__
]
=
value
finally
:
inst
.
_cache_mutex
.
unlock
()
inst
.
_cache_mutex
.
unlock
()
inst
.
_cache_mutex
.
unlock
()
return
value
return
value
...
@@ -341,14 +343,12 @@ class Person(object):
...
@@ -341,14 +343,12 @@ class Person(object):
:return: True if a changed was made by the reload.
:return: True if a changed was made by the reload.
'''
'''
self
.
_cache_mutex
.
lock
()
self
.
_cache_mutex
.
lock
()
try
:
if
community
.
currency
not
in
self
.
_cache
:
if
community
.
currency
not
in
self
.
_cache
:
self
.
_cache
[
community
.
currency
]
=
{}
self
.
_cache
[
community
.
currency
]
=
{}
change
=
False
change
=
False
try
:
before
=
self
.
_cache
[
community
.
currency
][
func
.
__name__
]
before
=
self
.
_cache
[
community
.
currency
][
func
.
__name__
]
except
KeyError
:
change
=
True
value
=
func
(
self
,
community
)
value
=
func
(
self
,
community
)
...
@@ -363,6 +363,12 @@ class Person(object):
...
@@ -363,6 +363,12 @@ class Person(object):
change
=
before
!=
value
change
=
before
!=
value
self
.
_cache
[
community
.
currency
][
func
.
__name__
]
=
value
self
.
_cache
[
community
.
currency
][
func
.
__name__
]
=
value
except
KeyError
:
change
=
True
except
Error
:
return
False
finally
:
self
.
_cache_mutex
.
unlock
()
self
.
_cache_mutex
.
unlock
()
return
change
return
change
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment