Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when removing first element of the list #1

Open
siggiorn opened this issue Jul 30, 2015 · 2 comments
Open

Problem when removing first element of the list #1

siggiorn opened this issue Jul 30, 2015 · 2 comments

Comments

@siggiorn
Copy link

Hey guys, I think I've observed incorrect behavior when removing the first element from the list:

I simply create the list with the strings 0, 1, 2, 3

var LinkedList = require('linkedlist')
var list = new LinkedList()
for (var i = 0; i < 4; i++) list.push(i.toString());

Now I iterate through the list and demonstrate that removing an element that isn't first works fine
console.log("\nExpect 0, 1, 2, 3");

while (list.next()) {
  console.log(list.current)
  if (list.current === "1") list.removeCurrent();
}

We see the following output 0, 1, 2, 3 and expect that the list now contains the strings 0, 2, 3

If we now iterate through the list again but this time remove the first element we get something unexpected:

list.resetCursor();
while (list.next()) {
  console.log(list.current)
 if (list.current === "0") list.removeCurrent();
}

Here we see 0, 3 but we expected 0, 2, 3

@kilianc
Copy link
Owner

kilianc commented Aug 3, 2015

@siggiorn thanks for reporting this, I am off duty for the next 3 weeks but I will try to look into this ASAP. If you want / can please submit a PR with a failing test suite, that would be super helpful

@siggiorn
Copy link
Author

siggiorn commented Aug 7, 2015

@kilianc no problem, just created that PR

lukebakken pushed a commit to basho/riak-nodejs-client that referenced this issue Mar 17, 2016
lukebakken pushed a commit to basho/riak-nodejs-client that referenced this issue Mar 17, 2016
Modify RiakConnection so that health check command is executed the same way as other commands.

Implement socket timeout, default of 5 seconds. Ensure correct events are raised on timeout.

Fix issues in socket timeout, improve logging

Add RiakCluster test to demonstrate handling of read timeouts.

Make data buffer private in RiakConnection

Make expiration routine private in RiakNode

add backoff to shutdown

Remove use of linkedlist module due to this bug: kilianc/node-linkedlist#1

Standardize on "health check" verbiage in logging, improve RiakNode state management, make _stateCheck functions protected

clarify debug log message

Fix connection count
lukebakken pushed a commit to basho/riak-nodejs-client that referenced this issue Mar 17, 2016
Modify RiakConnection so that health check command is executed the same way as other commands.

Implement socket timeout, default of 5 seconds. Ensure correct events are raised on timeout.

Fix issues in socket timeout, improve logging

Add RiakCluster test to demonstrate handling of read timeouts.

Make data buffer private in RiakConnection

Make expiration routine private in RiakNode

add backoff to shutdown

Remove use of linkedlist module due to this bug: kilianc/node-linkedlist#1

Standardize on "health check" verbiage in logging, improve RiakNode state management, make _stateCheck functions protected

clarify debug log message

Fix connection count
lukebakken pushed a commit to basho/riak-nodejs-client that referenced this issue Mar 18, 2016
Modify RiakConnection so that health check command is executed the same way as other commands.

Implement socket timeout, default of 5 seconds. Ensure correct events are raised on timeout.

Fix issues in socket timeout, improve logging

Add RiakCluster test to demonstrate handling of read timeouts.

Make data buffer private in RiakConnection

Make expiration routine private in RiakNode

add backoff to shutdown

Remove use of linkedlist module due to this bug: kilianc/node-linkedlist#1

Standardize on "health check" verbiage in logging, improve RiakNode state management, make _stateCheck functions protected

clarify debug log message

Fix connection count

Fix double registration for 'data' event.

Combine common response handling code between RiakConnection and RiakNode

Smal fix, event debugging comment added to RiakConnection
lukebakken pushed a commit to basho/riak-nodejs-client that referenced this issue Mar 18, 2016
Modify RiakConnection so that health check command is executed the same way as other commands.

Implement socket timeout, default of 5 seconds. Ensure correct events are raised on timeout.

Fix issues in socket timeout, improve logging

Add RiakCluster test to demonstrate handling of read timeouts.

Make data buffer private in RiakConnection

Make expiration routine private in RiakNode

add backoff to shutdown

Remove use of linkedlist module due to this bug: kilianc/node-linkedlist#1

Standardize on "health check" verbiage in logging, improve RiakNode state management, make _stateCheck functions protected

clarify debug log message

Fix connection count

Fix double registration for 'data' event.

Combine common response handling code between RiakConnection and RiakNode

Smal fix, event debugging comment added to RiakConnection
lukebakken pushed a commit to basho/riak-nodejs-client that referenced this issue Mar 18, 2016
Modify RiakConnection so that health check command is executed the same way as other commands.

Implement socket timeout, default of 5 seconds. Ensure correct events are raised on timeout.

Fix issues in socket timeout, improve logging

Add RiakCluster test to demonstrate handling of read timeouts.

Make data buffer private in RiakConnection

Make expiration routine private in RiakNode

add backoff to shutdown

Remove use of linkedlist module due to this bug: kilianc/node-linkedlist#1

Standardize on "health check" verbiage in logging, improve RiakNode state management, make _stateCheck functions protected

clarify debug log message

Fix connection count

Fix double registration for 'data' event.

Combine common response handling code between RiakConnection and RiakNode

Smal fix, event debugging comment added to RiakConnection
lukebakken pushed a commit to basho/riak-nodejs-client that referenced this issue Mar 18, 2016
Modify RiakConnection so that health check command is executed the same way as other commands.

Implement socket timeout, default of 5 seconds. Ensure correct events are raised on timeout.

Fix issues in socket timeout, improve logging

Add RiakCluster test to demonstrate handling of read timeouts.

Make data buffer private in RiakConnection

Make expiration routine private in RiakNode

add backoff to shutdown

Remove use of linkedlist module due to this bug: kilianc/node-linkedlist#1

Standardize on "health check" verbiage in logging, improve RiakNode state management, make _stateCheck functions protected

clarify debug log message

Fix connection count

Fix double registration for 'data' event.

Combine common response handling code between RiakConnection and RiakNode

Smal fix, event debugging comment added to RiakConnection

re-register for events after setting up TLS connection
lukebakken pushed a commit to basho/riak-nodejs-client that referenced this issue Apr 9, 2016
Modify RiakConnection so that health check command is executed the same way as other commands.

Implement socket timeout, default of 5 seconds. Ensure correct events are raised on timeout.

Fix issues in socket timeout, improve logging

Add RiakCluster test to demonstrate handling of read timeouts.

Make data buffer private in RiakConnection

Make expiration routine private in RiakNode

add backoff to shutdown

Remove use of linkedlist module due to this bug: kilianc/node-linkedlist#1

Standardize on "health check" verbiage in logging, improve RiakNode state management, make _stateCheck functions protected

clarify debug log message

Fix connection count

Fix double registration for 'data' event.

Combine common response handling code between RiakConnection and RiakNode

Smal fix, event debugging comment added to RiakConnection

re-register for events after setting up TLS connection

Prepare to merge PR #145
lukebakken pushed a commit to basho/riak-nodejs-client that referenced this issue Apr 10, 2016
Modify RiakConnection so that health check command is executed the same way as other commands.

Implement socket timeout, default of 5 seconds. Ensure correct events are raised on timeout.

Fix issues in socket timeout, improve logging

Add RiakCluster test to demonstrate handling of read timeouts.

Make data buffer private in RiakConnection

Make expiration routine private in RiakNode

add backoff to shutdown

Remove use of linkedlist module due to this bug: kilianc/node-linkedlist#1

Standardize on "health check" verbiage in logging, improve RiakNode state management, make _stateCheck functions protected

clarify debug log message

Fix connection count

Fix double registration for 'data' event.

Combine common response handling code between RiakConnection and RiakNode

Smal fix, event debugging comment added to RiakConnection

re-register for events after setting up TLS connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants