Repository navigation
vlib: add pool module - #24661
vlib: add pool module#24661
Conversation
|
Connected to Huly®: V_0.6-23020 |
|
I suggest rename the ConnectionPoolable methods, IMO the struct name (that implements interface) should make it clear that the action is performed on the connection. Using the |
Yes, this may simplify the interface methods' name. |
|
That ConnectionPool looks so complex to me |
|
Do we have any way to test race conditions? |
|
Please, use time.utc instead of time.now, for performance reasons. Is that ok? |
Yes, this is a little complex :) |
|
simply replace |
|
Please don't merge this. As I found on |
Usually, valgrid is used to do these tests. I saw that there are some tests using valgrid in V. Maybe @spytheman can help us with that. |
|
Should this be rebased on master, now that a9f4a94 is merged, or are there other things that will need to be fixed before that? |
Just wait sometime, as atomic still has some bugs. I am working on a |
|
MSVC generated code has bug... mut conn := p.get()! as MockConnwill generated code twice: _result_pool__ConnectionPoolable_ptr _t5 = pool__ConnectionPool_get(p);
if (_t5.is_error) {
main__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, 273, tos3("connection_test.v"), tos3("main"), tos3("test_error_handling"), IError_name_table[_t5.err._typ]._method_msg(_t5.err._object) );
longjmp(g_jump_buffer, 1);
}
_result_pool__ConnectionPoolable_ptr _t6 = pool__ConnectionPool_get(p);
if (_t6.is_error) {
main__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, 273, tos3("connection_test.v"), tos3("main"), tos3("test_error_handling"), IError_name_table[_t6.err._typ]._method_msg(_t6.err._object) );
longjmp(g_jump_buffer, 1);
}
main__MockConn *conn = HEAP(main__MockConn, (*(main__MockConn*)__as_cast(((*(pool__ConnectionPoolable**)_t5.data))->_main__MockConn,v_typeof_interface_idx_pool__ConnectionPoolable(((*(pool__ConnectionPoolable**)_t6.data))->_typ), 133)));and this cause assert fail |
try simplifying it to: mut tconn := p.get()!
mut conn := tconn as MockConnto see if it will trigger a non buggy codegen in msvc |
|
Oh, you already did. |
|
The CI passed now for msvc too after the second retry. |
Is |
|
Yes, it can be skipped with |
|
It timed out for a tcc-windows job on master too: I'll see how it will behave in the coming days, it may need a !windows build tag 🤔 for now. |
|
It fails sporadically for gcc-windows too: https://github.com/vlang/v/actions/runs/15751959355/attempts/1 and https://github.com/vlang/v/actions/runs/15751959355/attempts/2 . It also failed on the PR that had the WaitGroup fix https://github.com/vlang/v/actions/runs/15752112204/job/44399224811 the first time. I'll change the build tag to !windows to prevent further false positives for unrelated PRs, until it is fixed for good. |
Feature request by #23995
Note: This a generic connection pool implementation for database connection, network connection....
To support database pool, it need further enhance in
db.mysqlor other database, to support theConnectionPoolableinterface.This module provides a robust connection pooling implementation for
managing reusable resources like database connections. It handles
connection lifecycle, validation, and efficient resource allocation
with minimal overhead.