Skip to content

Adapt Service protocol from swift-service-lifecycle #37

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

Merged
merged 2 commits into from
Sep 4, 2023

Conversation

dkz2
Copy link
Contributor

@dkz2 dkz2 commented Aug 24, 2023

This PR address the need to integrate swift-service-lifecycle's Service protocol into our MemcachedConnection.
The incorporation of the Service protocol will ensure a unified and standardized lifecycle management for our Memcached service. This PR will close #36.

Motivation:
To adopt industry standards for service lifecycle management and improve the maintainability and operability of our MemcachedConnection. Incorporating the Service protocol enhances the way we manage the startup and shutdown procedures of the service.

Modifications:

  • Implemented the Service protocol in MemcachedConnection.
  • Updated our Program example to now use ServiceGroup initialization to include MemcachedConnection as a Service.

Results:
With the integration of the Service protocol, MemcachedConnection now benefits from standardized lifecycle management. This improves the reliability of the service and makes it easier to manage in production setups.

@dkz2 dkz2 changed the title Adapt Service protocol from swift-service-lifecycle Adapt Service protocol from swift-service-lifecycle Aug 24, 2023
@dkz2 dkz2 marked this pull request as ready for review August 24, 2023 13:55
Comment on lines 33 to 41
let serviceGroupConfiguration = ServiceGroupConfiguration(
services: [ServiceGroupConfiguration.ServiceConfiguration(service: memcacheConnection)],
gracefulShutdownSignals: [],
cancellationSignals: [],
logger: self.logger
)

// Initialize the service group
let serviceGroup = ServiceGroup(configuration: serviceGroupConfiguration)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the shorter init here

Suggested change
let serviceGroupConfiguration = ServiceGroupConfiguration(
services: [ServiceGroupConfiguration.ServiceConfiguration(service: memcacheConnection)],
gracefulShutdownSignals: [],
cancellationSignals: [],
logger: self.logger
)
// Initialize the service group
let serviceGroup = ServiceGroup(configuration: serviceGroupConfiguration)
// Initialize the service group
let serviceGroup = ServiceGroup(services: memcacheConnection)

@FranzBusch FranzBusch merged commit ed50014 into swift-server:main Sep 4, 2023
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

Successfully merging this pull request may close these issues.

Adapt Service protocol from swift-service-lifecycle
2 participants