async-event-interval's People
async-event-interval's Issues
Check if 'destroy' in events shared hash works if program crashes
Repeated error handling in start() can be deduplicated after cb execution regardless of interval or not
start() check for is running is faulty
it's checking $self->{stop}
, which is wrong. We need to set a {started}
flag, add a status()
method that checks for started
, and return that.
_rand_shm_key() may produce dups
Which would result in overwriting a previous entry in the %entries
hash.
start() should accept the callback params, not new()
When in new()
, the same parameters are sent in on every restart.
Send them to start()
, then pass them through to _event()
.
add ability to return a value from the event closure
send in a variable name as a param, and set it in the callback. then add a fetch()
or equivalent method to fetch this data
Allow shared_scalar() to take a custom shm key
This will allow two separate scripts to load up the same variable. Needs also to have a way to identify which script should destroy the memory segment and semaphores.
Two events in one script appear to leak a segment
Test script 81-fork_dup_rand_key.t
in IPC::Shareable
.
use warnings;
use strict;
use Async::Event::Interval;
use Data::Dumper;
use IPC::Shareable;
use Test::More;
BEGIN {
if (! $ENV{CI_TESTING}) {
plan skip_all => "Not on a legit CI platform...";
}
}
warn "Segs Before: " . IPC::Shareable::ipcs() . "\n" if $ENV{PRINT_SEGS};
my $segs_before = IPC::Shareable::ipcs();
{
tie my %shared_data, 'IPC::Shareable', {
key => 'fork rand dup keys',
create => 1,
destroy => 1
};
$shared_data{$$}{called}++;
my $event_one = Async::Event::Interval->new(0, sub {$shared_data{$$}{called}++});
my $event_two = Async::Event::Interval->new(0, sub {$shared_data{$$}{called}++});
$event_one->start;
$event_two->start;
sleep 1;
$event_one->stop;
$event_two->stop;
my $one_pid = $event_one->pid;
my $two_pid = $event_two->pid;
is exists $shared_data{$one_pid}{called}, 1, "Event one got a rand shm key ok";
is exists $shared_data{$two_pid}{called}, 1, "Adding srand() ensures _shm_key_rand() gives out rand key in fork()";
(tied %shared_data)->clean_up_all;
}
IPC::Shareable::_end;
Async::Event::Interval::_end;
warn "Segs After: " . IPC::Shareable::ipcs() . "\n" if $ENV{PRINT_SEGS};
my $segs_after = IPC::Shareable::ipcs();
is $segs_after, $segs_before, "2nd event segs were cleaned up ok";
done_testing();
Output:
Segs Before: 81
ok 1 - Event one got a rand shm key ok
ok 2 - Adding srand() ensures _shm_key_rand() gives out rand key in fork()
Segs After: 82
not ok 3 - 2nd event segs were cleaned up ok
# Failed test '2nd event segs were cleaned up ok'
# at t/81-fork_dup_rand_keys.t line 53.
# got: ' 82'
# expected: ' 81'
1..3
# Looks like you failed 1 test of 3.
Failed test 'done_testing() was already called at t/45-params.t
On some of my smoker systems the test suite fails like this:
# Failed test 'done_testing() was already called at t/45-params.t line 26'
# at t/45-params.t line 26.
t/45-params.t ..........
All 3 subtests passed
t/15-interval.t may fail
See subject. A list of failed CPAN Testers test reports with this problem may be found here:
http://analysis.cpantesters.org/reports_by_field?SUBMIT_xxx=Submit&distv=Async-Event-Interval-1.00&field=fail%3At%2F15-interval.t&field=meta%3Aosname%2Bperl
interval loop in _pm() needs a 'continue' hook to break the loop so it can finish()
"timeout" option
Add another param in new()
that sets a timeout. If the event hasn't done something in X time, end itself
Many test failures
The last Async-Event-Interval releases show many test failures, see http://matrix.cpantesters.org/?dist=Async-Event-Interval+1.08
Looking at the individual test reports I don't see any patterns, also the failures look quite different.
Add new() param that allows executing callback immediately or after the first interval
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.