On Monday 10 November 2008 15:17, batosai at freenetproject.org wrote:
> Author: batosai
> Date: 2008-11-10 15:16:59 +0000 (Mon, 10 Nov 2008)
> New Revision: 23468
>
> Modified:
> trunk/plugins/WoT/Identity.java
> Log:
> We commit() after the whole tree calculation is done, in WoT.setTrust, to be
sure that the database is consistent. If you commit just after storing the
new trust and there is a problem before the end of the calculation. The new
trust will exist but be ignored in the trust tree until it is modified.
> If you only commit at the end of the process and there is a problem, the
calculation will restart when the plugin will find the trust again, as it
will see it as new.
In which case, terminate()ing the plugin should rollback(), not commit().
>
> Modified: trunk/plugins/WoT/Identity.java
> ===================================================================
> --- trunk/plugins/WoT/Identity.java 2008-11-10 14:57:06 UTC (rev 23467)
> +++ trunk/plugins/WoT/Identity.java 2008-11-10 15:16:59 UTC (rev 23468)
> @@ -397,20 +397,17 @@
> if(!trust.getComment().equals(comment)) {
> trust.setComment(comment);
> db.store(trust);
> - db.commit(); /* TODO: this commit was not here
> until I added it, is
there a reason for that? */
> }
>
> if(trust.getValue() != value) {
> trust.setValue(value);
> db.store(trust);
> - db.commit(); /* TODO: this commit was not here
> until I added it, is
there a reason for that? */
> Logger.debug(this, "Updated trust value ("+
> trust +"), now updating
Score.");
> trustee.updateScore(db);
> }
> } catch (NotTrustedException e) {
> trust = new Trust(this, trustee, value, comment);
> db.store(trust);
> - db.commit(); /* TODO: this commit was not here until I
> added it, is
there a reason for that? */
> Logger.debug(this, "New trust value ("+ trust +"), now
> updating
Score.");
> trustee.updateScore(db);
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL:
<https://emu.freenetproject.org/pipermail/devl/attachments/20081112/e1a61f96/attachment.pgp>