Skip to content

Commit cabbbcb

Browse files
committed
Cache server version
1 parent 4f32dd7 commit cabbbcb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/com/debortoliwines/odoo/api/Session.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class Session {
4949
private RPCProtocol protocol;
5050

5151
private OdooXmlRpcProxy objectClient;
52+
private Version serverVersion;
5253

5354
/**
5455
* *
@@ -266,7 +267,11 @@ public void executeWorkflow(final String objectName, final String signal, final
266267
* @throws XmlRpcException
267268
*/
268269
public Version getServerVersion() throws XmlRpcException {
269-
return OdooXmlRpcProxy.getServerVersion(protocol, host, port);
270+
if (serverVersion == null) {
271+
// Cache server version
272+
serverVersion = OdooXmlRpcProxy.getServerVersion(protocol, host, port);
273+
}
274+
return serverVersion;
270275
}
271276

272277
/**

0 commit comments

Comments
 (0)